How to specify active profiles in Maven3

Our application consists of various active profiles (for example, A1, A2, A3, A5 ...), which were separately defined in the profiles.xml file. Maven 3 expects all profile information to be saved as part of the pom.xml file itself.

How to specify a list of active profiles in the pom.xml file so that I can not specify them on the command line (for example, mvn -PA1, A2, A3, A5)

+8
maven maven-3 profile
source share
2 answers

If so:

<profiles> <profile> <id>profile-1</id> <activation> <activeByDefault>true</activeByDefault> </activation> ... </profile> </profiles> 

From here .

+8
source share

In addition to @ javamonkey79's answer, you can use settings.xml. There are parts of profiles and activations. Take a look at the following example:

  <profiles> <profile> <id>hudson-simulate</id> <properties> <gituser>username</gituser> <gitpassword>secret</gitpassword> </properties> </profile> <profile> <id>other-profile</id> <properties> <proerty1>username</property1> </properties> </profile> </profiles> <activeProfiles> <activeProfile>hudson-simulate</activeProfile> <activeProfile>other-profile</activeProfile> </activeProfiles> 
+4
source share

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


All Articles