开发者

Maven multi module build and run

In one of our projects we've switched the build system from A开发者_Python百科nt to Maven. The project has many corresponding modules so we decided to make a multi module Maven project. We're using NetBeans for coding and building/running/debugging the software.

If i right click the super POM's project i can use clean and build which actually rebuilds all the sub modules in order they are defined in the super POM. I can also run the code from the sub project's menu which contains the main code when the dependant modules were compiled and installed into the local repository previously.

I'm wondering would it be possible to run the project from the super POM's menu? This would involve running the specific sub module, but it would be nice to automatically build all outdated sub modules aswell. (I guess this would be better if triggered by the runnable artifact's project not by the parent project) The previous Ant system did this at Run. Now we must do this manually with Maven.

I know that rebuilding involves installing the rebuilt artifact into the local repository again and again but because we're developing with SNAPSHOT versions i don't think this is a problem.


typically you should be executing Run Project from the child project of the final assembly.. (the jar/war/..) to enable building the dependent projects before running, either manually execute Build with dependencies on the affected projects or configure the Run Project action in project properties panel accordingly, see screenshot http://screencast.com/t/fRAgLdj6


So, first a little context to my answer. We use the pre-integration-test, integration-test, and post-integration-test phases to start our application, run integration tests, and shut it back down respectively. This is a common pattern with maven, though it takes some work to get the right plugins working in the right phases (and the specifics of how to do this vary from app to app).

Given that background, it's fairly trivial to run mvn pre-integration-test to build everything, start the application, then leave it running (or alternately, just manually adjust add <defaultGoal>pre-integration-test</defaultGoal> to the build section). This fits nicely in the maven pattern.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜