mvn clean install vs. deploy vs. release [英] mvn clean install vs. deploy vs. release

查看:384
本文介绍了mvn clean install vs. deploy vs. release的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是在学习maven,我们最近需要走的越来越多。我想知道



mvn clean install之间的区别


$ b b

mvn release



mvn deploy / p>

请尽可能描述。

解决方案

$ c> clean ,安装部署 阶段有效的生命周期阶段,并调用它们将触发所有它们之前的阶段,以及这些阶段的目标。


mvn clean install


依次调用 clean 阶段和 install




  • clean 删除项目目录中构建时生成的文件 target 将 安装到 local strong> repository,用于在本地其他项目中作为依赖项。




此命令调用 deploy 阶段:




  • deploy 将最终包复制到远程




  • 这不是有效的阶段,也不是目标,所以这不会做任何事情。但如果提到用于自动发布管理的 Maven Release Plugin 。发布项目分为两个步骤: prepare 执行。如记录所示:


    准备发布在发布阶段后通过




    • 检查来源中是否有未提交的变更

    • 检查是否没有SNAPSHOT依赖项

    • 将POM中的版本从x-SNAPSHOT更改为新版本(您将提示您
      的版本为

    • 转换POM以包含标记的最后
      目标

    • 对修改的POM运行项目测试,以确认一切是正确的

    • 提交修改的POM

    • 使用版本名称标记SCM中的代码(将提示


    • 提交已修改的POM


    然后:


    发布之后运行




    • 从具有可选标记的SCM URL中结帐

    • 运行预定义的Maven目标以释放项目(默认情况下为
      deploy site-deploy)




    另请参阅




    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.

    解决方案

    The clean, install and deploy phases are valid lifecycle phases and invoking them will trigger all the phases preceding them, and the goals bound to these phases.

    mvn clean install

    This command invokes the clean phase and then the install 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.

    mvn deploy

    This command invokes the deploy phase:

    • deploy: copies the final package to the remote repository for sharing with other developers and projects.

    mvn release

    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 and perform. As documented:

    Preparing a release goes through the following release phases:

    • Check that there are no uncommitted changes in the sources
    • Check that there are no SNAPSHOT dependencies
    • Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
    • Transform the SCM information in the POM to include the final destination of the tag
    • Run the project tests against the modified POMs to confirm everything is in working order
    • Commit the modified POMs
    • Tag the code in the SCM with a version name (this will be prompted for)
    • Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
    • Commit the modified POMs

    And then:

    Performing a release runs the following release phases:

    • Checkout from an SCM URL with optional tag
    • Run the predefined Maven goals to release the project (by default, deploy site-deploy)

    See also

    这篇关于mvn clean install vs. deploy vs. release的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆