mvn 全新安装、部署、发布
我刚刚学习maven,最近需要走的越来越多。我想知道
mvn clean install
mvnrelease
mvndeploy
之间的区别请尽可能具有描述性。
I am just learning maven, and we have recently needed to go more and more. I would like to know the difference between
mvn clean install
mvn release
mvn deploy
Please be as descriptive as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
clean
、install
和deploy
阶段是有效的生命周期阶段并调用它们将触发它们之前的所有阶段,以及与这些阶段绑定的目标。此命令依次调用
clean
阶段和install
阶段:clean
:删除在构建时生成的文件项目目录(默认为target
)install
:将包安装到本地存储库中,用作本地其他项目的依赖。此命令调用
deploy
阶段:deploy
:将最终包复制到远程存储库,以便与其他开发人员和项目共享。这不是一个有效的阶段,也不是一个目标,所以这不会做任何事情。但 if 指的是用于自动化发布管理的Maven Release Plugin。发布项目分两步完成:
准备
和执行
。据记录:然后:
另请参阅
The
clean
,install
anddeploy
phases are valid lifecycle phases and invoking them will trigger all the phases preceding them, and the goals bound to these phases.This command invokes the
clean
phase and then theinstall
phase sequentially:clean
: removes files generated at build-time in a project's directory (target
by default)install
: installs the package into the local repository, for use as a dependency in other projects locally.This command invokes the
deploy
phase:deploy
: copies the final package to the remote repository for sharing with other developers and projects.This is not a valid phase nor a goal so this won't do anything. But if refers to the Maven Release Plugin that is used to automate release management. Releasing a project is done in two steps:
prepare
andperform
. As documented:And then:
See also
mvn install
会将您打包的 Maven 项目放入 本地 存储库中,以便本地应用程序使用您的项目作为依赖项。mvn release
基本上会将您当前的代码放在 SCM 上的标签中,更改项目中的版本。mvn deploy
会将您打包的 Maven 项目放入远程存储库中,以便与其他开发人员共享。资源:
mvn install
will put your packaged maven project into the local repository, for local application using your project as a dependency.mvn release
will basically put your current code in a tag on your SCM, change your version in your projects.mvn deploy
will put your packaged maven project into a remote repository for sharing with other developers.Resources :