4

在 Maven 中,是否有某种方法可以指定 JUnit 测试仅在有一些源代码更改时运行?

例如,我看到这条消息

[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ my_project ---
[INFO] Nothing to compile - all classes are up to date

现在 - 因为没有编译代码(因为上次编译没有更改),我宁愿不运行任何测试。这可能吗?

4

1 回答 1

1

Your project setup should be broken up into separate modules. However if you can not do that you could set the maven.test.skip property in your profiles in which you want no tests to be run. See more about skipping tests on the site.

You are talking about a war project. Typically a war project should NOT have any code in it, but rather just some configuration and stuff like html, jsp, css and java script and bundle jar projects, that contain java code. The jar projects will have the code. And if you do integration tests a good practice is to have them in separate modules.

Different war configs can be in profiles or potentially also in separate modules using the war overlay feature of the maven war plugin.

于 2012-06-11T22:12:50.350 回答