Meta-profiles in Maven
I'm looking for a way to create meta-profiles that just activate sub-profiles in Maven. Let's take a very concrete example. I have the following profiles:
To build the project, you have to choose one profile for the server and one for the database. I want to create two "meta-profiles":
- "dev" => "server-tomcat","database-hsql"
- "prod" => "server-jboss","database-oracle"
The first idea that comes is to activate the subprofiles by a property:
<profile> <id>database-oracle</id> <activation> <property> <name>prod</name> </property> </activation> </profile>
But this way, I cannot share subprofiles between meta-profiles. For example, I want my profile "database-oracle" to be activated by both "pre-prod" and "prod" meta-profiles.
Note: my sub-profiles just contain properties. They are used for filtering resources and in the child poms. This is why I think there could be a solution for this particular situation.
The ideal situation for me would be to have them externalized in external properties files, but one issue at a time ;)
Activating profiles from another profile is not possible (this has been discussed in this previous question). Your first idea, using identical properties to activate different profiles, is the best thing you can implement but has indeed limitations.