该项目的测试非常重,并且要继续开发,我默认要跳过。但是,如果指定,它们将定期为给定环境运行。这是我到目前为止所拥有的。
<project>
<properties>
<skip.tests>true</skip.tests>
</properties>
<profiles>
<profile>
<id>test.dev</id>
<properties>
<env>dev</env>
<test.info>123456789</test.info>
<skip.tests>false</skip.tests>
</properties>
</profile>
<profile>
<id>test.int</id>
<properties>
<env>int</env>
<test.info>987654321</test.info>
<skip.tests>false</skip.tests>
</properties>
</profile>
<profile>
<id>skip.tests</id>
<activation>
<property>
<name>skip.tests</name>
<value>true</value>
</property>
</activation>
<properties>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
</profiles>
</project>
当我使用配置文件运行时,它看起来不错。
$ mvn help:active-profiles -Ptest.dev
The following profiles are active:
- test.dev
and没有args:
$ mvn help:active-profiles
The following profiles are active:
我想说的是:
$ mvn help:active-profiles
The following profiles are active:
- skip.tests
您应该在个人资料定义中添加类似的内容:
<profiles>
<profile>
<id>profile-1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
...
</profile>
</profiles>