I tend to avoid using mvn install
in my multi-module projects because I feel like I then don't know which exact version of a submodule is then used when building / launching other submodules (particularly when switching between branches very often).
I tend to use mvn package
a lot and then mvn verify
.
I'm now facing the issue in a FOSS project (a Maven archetype moreover) where I'd like to use Maven's best practices.
It's a multi-module project with a webapp submodule depending on the other modules, and what worries me is the ease of development along with mvn jetty:run
(or jetty:start
).
Currently, I defined 2 profiles:
prod
, the default one, declares dependencies on the other submodules;dev
on the other hand does not depend on the other modules, and configures thejetty-maven-plugin
by adding the other modules' output directories asextraClasspath
andresourcesAsCSV
.
That way, I canmvn package
once and thencd webapp && mvn jetty:start -Pdev
and quickly iterate, reloading the webapp without the need to even stop the server.
AFAICT, extraClasspath
was added for that exact purpose (JETTY-1206).
I've been pointed at the tomcat7-maven-plugin
which can resolve modules from the reactor build when using Maven 3 (and I raised an issue to bring the same to Jetty: JETTY-1517), but that hardly solve my
If I hadn't removed the dependency on the other submodules from in dev
profile, I'd have had to do an mvn install
first so that validating the POM doesn't fail, even if jetty:start
doesn't use those dependencies afterwards.
So here's my question: is mvn install
really that common? or my approach of putting the intra-reactor dependencies only in the prod
profile OK?
(note that I have the exact same problem with the gwt-maven-plugin
, so please don't tell me to simply switch to Tomcat; that wouldn't even work actually, details here)