WHAT'S NEW?
Loading...

Maven: How do I activate a profile from command line?

Simple pom.xml  file:
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <!-- ... everything else -->
  <profiles>
    <profile>
      <id>dev</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <environment.name>development</environment.name>
      </properties>
    </profile>
    <profile>
      <id>production</id>
      <properties>
        <environment.name>production</environment.name>
      </properties>
    </profile>
  </profiles>
</project>

Run your mvn cli command as : mvn clean install -Pdev -DprofileIdEnabled=true.

More infos https://dzone.com/articles/maven-profile-best-practices

0 comments:

Post a Comment