这是我的 pom.xml 中的一个片段。 我尝试了以下方法,但侧写没有激活。
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>
我想知道为什么我的个人资料没有被激活。有人遇到过类似的问题吗?