This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes Build module with specific profile from Parent project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Build module with specific profile from Parent project" Watch "Build module with specific profile from Parent project" New topic
Author

Build module with specific profile from Parent project

Dusan Macek
Greenhorn

Joined: Feb 08, 2013
Posts: 1
Hi, I've got Maven parent project in Netbeans which has 2 modules..

But module1 uses profiles and I want it to be built with profile2 (now it's always profile1). How can I parse which profile is used for specific module?
Thanks for help..
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Don't do that.

I keep on telling people that using the master/submodule relationship, which you are using, will just cause headaches. Instead do this. Define three separate projects - you two existing submodules are two of the projects, the master module becomes its own project with no submodules (instead reference the artifacts created by the submodules as dependencies). Then in Jenkins (or whatever continuous integration manager you use) define the build jobs such that once either "submodule" job is finished that the "master" job should be run.

Of course, if your master POM doesn't build any artifact, then it is even easier - you don't need to define the third project!

I used this very successfully at work for one of our products. There are about a dozen projects, many of which are rolled up into a zip file by another project. That zip project is a separate project that defines the other dozen project's artifacts as dependencies. (One of my coworkers, again my recommendation, went with a master/submodule scheme for one of the projects he migrated to Maven and that team is still struggling with the build process; one of their issues bu=eing that each time they do a build they need to compile the whole world, even submodules that haven't changed.)

Anyway, with completely separate projects you can give different profiles to each project's build.


JBoss In Action
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Build module with specific profile from Parent project
 
Similar Threads
Switching Modules in Strurts1.1
Struts modules - html:form can't find action
Ear Building in Maven
passing the parameters and reading them in maven
Jenkins incremental build & Maven