Hi, This is a repost from a StackOverflow question: http://stackoverflow.com/q/10686682/116472
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][1] (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: 1. `prod`, the default one, declares dependencies on the other submodules; 2. `dev` on the other hand does **not** depend on the other modules, and configures the `jetty-maven-plugin` by adding the other modules' output directories as `extraClasspath` and `resourcesAsCSV`. That way, I can `mvn package` once and then `cd 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][2]). 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][3]), but that hardly solve my If I hadn't removed the dependency on the other submodules from the `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 is 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][4]) NOTE: I'm looking for a _best practice_, not only a pragmatic solution. I don't quite like my current approach, but I'm not comfortable installing half-baked things in my local repo. But maybe it's just me and `mvn install` is the way Maven is/was thought out? (and leaning to resolving from the reactor build in Maven 3, but that requires plugins to update) [1]: https://github.com/tbroyer/gwt-maven-archetypes [2]: http://jira.codehaus.org/browse/JETTY-1206 [3]: http://jira.codehaus.org/browse/JETTY-1517 [4]: https://github.com/tbroyer/gwt-maven-archetypes/pull/13#issuecomment-5809904 -- Thomas Broyer /tɔ.ma.bʁwa.je/ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
