这个项目的测试非常繁重,为了保持开发,我想默认跳过。但是,如果指定,它们将针对给定环境定期运行。这是我到目前为止所拥有的。
<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
没有args:
$ mvn help:active-profiles
The following profiles are active:
我想说的是:
$ mvn help:active-profiles
The following profiles are active:
- skip.tests
答案 0 :(得分:1)
您应该在个人资料定义中添加以下内容:
<profiles>
<profile>
<id>profile-1</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
...
</profile>
</profiles>