【发布时间】:2015-09-04 18:47:14
【问题描述】:
这是来自我的 pom.xml 的 sn-p。 我尝试了以下操作,但配置文件未激活。
mvn clean install -Pdev1
mvn clean install -P dev1
当我尝试mvn help:active-profiles 时,没有配置文件被列为活动。
如果我将dev1 的<activeByDefault> 设置为true,并运行mvn help:active-profiles,它显示配置文件已激活。
<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>
我想知道为什么我的个人资料没有被激活。有没有人遇到过类似的问题?
【问题讨论】:
-
至少使用 maven 3.5.3
-P确实可以按预期工作...FWIW...