Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 638729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:45:53+00:00 2026-05-13T20:45:53+00:00

I’m currently developing multiple web applications using Spring. I’m using Maven for building and

  • 0

I’m currently developing multiple web applications using Spring. I’m using Maven for building and Git for version control. At the moment I’m trying to find a way to split development of some things used by all webapps, e.g. I have some helper classes that are the same for all projects. The problem is, I don’t want to use only classes, but also resource files and some sort of parent POM while still being independent from a repository and able to benefit from Git.

Although I’m not enthusiastic to change the build system, I’m not a real fan of Maven. Especially the concept of inheritance and aggregation is what constrains me right now. Maybe Ivy is an option?

I’d want to give you a quick overview of my setup:

There’s some sort of parent project including some classes, Spring configuration files and other resources like templates, images and style sheets. Let’s call it base. This one is not a complete Spring webapp and won’t be deployed. There are several other projects which inherit from base and should be packed into a WAR. Let’s call them webapp1 and webapp2.

base, webapp1 and webapp2 have their own Git repositories:

\
 |
 |- base.git       (base's repository)
 |
 |- webapp1.git    (webapp1's repository)
 | \
 |   base          (base used as a Git submodule)
 |
 |- webapp2.git    (webapp2's repository)
   \
     base          (base used as a Git submodule)

I want to be able to change bases code from inside the the webapps using a Git submodule and also be able to build a fully functional WAR of each webapp using mvn package inside the webapp`s directory.

Maven’s parent or module don’t allow a dynamic approach like this. I didn’t find a way to use module like that at all and using parent for my needs is complex and static: Every change to base would require a new version to be pushed to the repository so that the webapp`s can inherit from it.

Maybe I didn’t completely understand Maven’s inheritance, but I’m pretty lost right now.

Did anyone achieve something similar with success? What build system did you use and how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:45:53+00:00Added an answer on May 13, 2026 at 8:45 pm

    I found a working solution by myself.

    The basic solution of my problem is a small sub-element of the <parent> element called <relativePath>. It allows to search for the parent POM in the specified directory. Otherwise you would always need to deploy a new version before you could test it within your application.

    <parent>
        <groupId>com.example</groupId>
        <artifactId>base</groupId>
        <version>1.0.0</groupId>
        <relativePath>base</relativePath>
    </parent>
    

    But that was only the starting point, allowing to work with a Git submodule. To get it really working, I needed to do the following:

    • Create a WAR with classes and resources from both, the webapp and base, i.e. all files inside

      base/src/main/java
      base/src/main/resources
      base/src/main/webapp
      src/main/java
      src/main/resources
      src/main/webapp
      

      While resources are pretty easy to cover, a bit of configuration for org.apache.maven.plugin:maven-war-plugin is needed to get the webapp resources into the WAR. Compiling of two different source folders requires a plugin, so I need to use org.codehaus.mojo:build-helper-maven-plugin to get the classes of base into the WAR.

    • Additionally, I used a lot of filtering for the resources, so there’s almost no need for customization of the basic files to get a webapp up and running. For example I use ${project.artifactId} inside my main template file, so my HTML <head> will look something like this for a webapp called webapp1:

      <link href="stylesheets/base.css" rel="stylesheet" media="screen" type="text/css" />
      <link href="stylesheets/webapp1.css" rel="stylesheet" media="screen" type="text/css" />
      

    It really took a lot of trial and error, but at last I got it working and I think this is the best way to achieve my target using Maven. This would’ve been a lot easier using a dynamic tool like Buildr, but sadly Buildr is slow on Windows (thanks to Ruby) and doesn’t integrate very well into most IDEs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 381k
  • Answers 381k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer ^[A-Za-z][A-Za-z0-9]*(?:_[A-Za-z0-9]+)*$ May 14, 2026 at 10:12 pm
  • Editorial Team
    Editorial Team added an answer First, yes you can store a read-only database inside of… May 14, 2026 at 10:12 pm
  • Editorial Team
    Editorial Team added an answer Those classes are hold as softreferences which are always eligible… May 14, 2026 at 10:12 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.