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 base
s 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?