How to specify active profiles in Maven3

user339108 picture user339108 · Jan 22, 2011 · Viewed 13.7k times · Source

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

How should I specify the list of active profiles within a pom.xml file, so that I can avoid specifying them in the command line (e.g. mvn -PA1,A2,A3,A5)

Answer

javamonkey79 picture javamonkey79 · Jan 22, 2011

Should this do it:

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

From here.