简体   繁体   English

“mvn clean install”运行测试,但不运行“mvn clean site”

[英]“mvn clean install” runs tests, but not “mvn clean site”

small question regarding Maven, and the difference between install and site.关于 Maven 的小问题,以及安装和现场的区别。

When running a very basic clean install, I can see the unit tests run fine, no problem at all.当运行一个非常基本的全新安装时,我可以看到单元测试运行良好,完全没有问题。

Then, I got the requirement to generate a website for the project, to put the test report, javadoc, etc...然后,我得到了为项目生成网站的需求,放置测试报告,javadoc等......

Therefore, I just went one step further into the maven lifecycle, mvn clean site instead of mvn clean install.因此,我只是在 maven 生命周期中更进一步,使用 mvn clean site 而不是 mvn clean install。

However, surprised, mvn clean site seems not to run test cases.然而,令人惊讶的是,mvn clean site 似乎没有运行测试用例。 (nothing changed from the mvn clean install run). (从 mvn clean install 运行没有改变)。

May I ask if this is expected?请问这是预期的吗? (site not running tests) (站点未运行测试)

And also, how to tell maven to also run tests during the site phase please?还有,如何告诉 maven 在站点阶段也运行测试?

Thank you谢谢

If you look at the lifecycle documentation from Maven ( https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#lifecycle-reference ), you can see, that the site lifecycle is a separate lifecycle from the default lifecycle. If you look at the lifecycle documentation from Maven ( https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#lifecycle-reference ), you can see, that the site lifecycle is a separate来自默认生命周期的生命周期。 Thus the site phase does not execute anything from the default lifecycle and you have to specify any phases, that you want to execute from the default lifecycle, in the command.因此,站点阶段不会从默认生命周期执行任何操作,您必须在命令中指定要从默认生命周期执行的任何阶段。

Yes, this is expected.是的,这是意料之中的。 You can run mvn clean test site if you want to run tests as well.如果您还想运行测试,也可以运行mvn clean test site

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM