Meta Profiles in Maven

I am looking for a way to create metaprofiles that simply activate subprofiles in Maven. Let's take a very concrete example. I have the following profiles:

  • "JBoss server"
  • server cat
  • "HSQL databases"
  • "Oracle database"

To create a project, you need to select 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 is to activate subprofiles by property:

<profile> <id>database-oracle</id> <activation> <property> <name>prod</name> </property> </activation> </profile> 

But in this way I cannot share subprofiles between metaprofiles. For example, I want my database-oracle profile to be activated by both the pre-prod and prod meta profiles.

Note: my subprofiles just contain properties. They are used to filter resources and for priests. That is why I think there might be a solution for this particular situation.

The ideal situation for me would be that they are externalized in external property files, but for one problem at a time;)

+4
source share
2 answers

It is not possible to activate profiles from another profile (this was discussed in this previous question ). Your first idea, using the same properties to activate different profiles, is the best you can implement, but it has really limitations.

+6
source

Have you tried the solution using the maven-properties plugin? Some possibilities are discussed in this question here .

+2
source

Source: https://habr.com/ru/post/1301836/


All Articles