pom.xml - Maven: How do I activate a profile from command line? -
this snippet pom.xml. tried following, profile not activated.
mvn clean install -pdev1 mvn clean install -p dev1
when tried mvn help:active-profiles
no profiles listed active. if set <activebydefault>
dev1
true
, , run mvn help:active-profiles
, shows me profile activated.
<profile> <id>dev1</id> <activation> <activebydefault>false</activebydefault> </activation> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <configuration> <systempropertyvariables> <env>local</env> <properties.file>src/test/resources/dev1.properties</properties.file> </systempropertyvariables> <suitexmlfiles> <suitexmlfile>src/test/resources/dev1.testng.xml</suitexmlfile> </suitexmlfiles> </configuration> </plugin> </plugins> </build> </profile> <profile> <id>dev2</id> <activation> <activebydefault>false</activebydefault> </activation> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <configuration> <systempropertyvariables> <env>local</env> <properties.file>src/test/resources/dev2.properties</properties.file> </systempropertyvariables> <suitexmlfiles> <suitexmlfile>src/test/resources/dev2.testng.xml</suitexmlfile> </suitexmlfiles> </configuration> </plugin> </plugins> </build> </profile>
i wondering why profile not getting activated. has encountered similar issue?
you won't see
mvn help:active-profiles
as there no -pdev1
in command.
you see mvn help:active-profiles -pdev1
(but there no point in that).
the commands showed :
mvn clean install -pdev1 mvn clean install -p dev1
are correct. problem not profile not activated, rather not expect to.
to make sure that's case, can set activebydefault
true on profile, launch mvn help:active-profiles
see it's activated, launch mvn install
, check if profile expect (which again not case).
Comments
Post a Comment