Java mvn install 和 mvn verify 的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/50260921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 23:32:14  来源:igfitidea点击:

Differences Between mvn install and mvn verify

javamavencommand-line

提问by Nicholas

What are the differences between Maven's mvn installand mvn verifycommands?

Mavenmvn installmvn verify命令之间有什么区别?

How does the keyword cleanmodify these commands?

关键字如何clean修改这些命令?

采纳答案by vatbub

mvn verify- as said before - performs any integration tests that maven finds in the project.

mvn verify- 如前所述 - 执行 maven 在项目中找到的任何集成测试。

mvn installimplicitly runs mvn verifyand then copies the resulting artifact into your local maven repository which you usually can find under C:\Users\username\.m2\repositoryif you are using windows.

mvn install隐式运行mvn verify,然后将生成的工件复制到本地 Maven 存储库中,C:\Users\username\.m2\repository如果您使用的是 Windows ,通常可以在该存储库下找到。

If you run maven multiple times without the cleancommand and without changing any source code, you may notice that it says Nothing to compile - all classes are up to dateduring the compile phase. If you add the cleancommand before any other command, maven will simply delete the entire targetdirectory resulting in all classes being recompiled.

如果你在没有clean命令的情况下多次运行 maven并且没有更改任何源代码,你可能会注意到它Nothing to compile - all classes are up to date在编译阶段说。如果在任何其他clean命令之前添加该命令,maven 将简单地删除整个target目录,从而导致重新编译所有类。

回答by ????g?ň?c????

From https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html:

https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

mvn install- install the package into the local repository, for use as a dependency in other projects locally

mvn install- 将包安装到本地存储库中,作为本地其他项目的依赖项

mvn verify- run any checks on results of integration tests to ensure quality criteria are met

mvn verify- 对集成测试的结果进行任何检查,以确保满足质量标准

cleanis a lifecycle that handles project cleaning. Commands involving cleanbefore it will clear the entire directory, meaning that all the classes have to be recompiled.

clean是处理项目清理的生命周期。clean之前涉及的命令会清空整个目录,意味着所有的类都必须重新编译。