“mvn clean install”如何?与“mvn install”不同吗?

发布于 2024-11-07 16:41:32 字数 73 浏览 0 评论 0原文

mvn clean installmvn install 之间有什么区别?

What is the difference between mvn clean install and mvn install?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

泛滥成性 2024-11-14 16:41:32

clean 是 Maven 中它自己的构建生命周期阶段(可以将其视为操作或任务)。 mvn clean install 告诉 Maven 在运行每个模块的 install 阶段之前在每个模块中执行 clean 阶段。

这样做的目的是清除您拥有的所有已编译文件,确保您真正从头开始编译每个模块。

clean is its own build lifecycle phase (which can be thought of as an action or task) in Maven. mvn clean install tells Maven to do the clean phase in each module before running the install phase for each module.

What this does is clear any compiled files you have, making sure that you're really compiling each module from scratch.

木森分化 2024-11-14 16:41:32

Maven 允许您在命令行上指定目标或生命周期阶段(或两者)。

cleaninstall两个不同生命周期的两个不同阶段,其中绑定了不同的插件目标(默认情况下或明确地 根据约定

clean 阶段的目的是使构建可重现,即它会清理以前构建创建的任何内容。在大多数情况下,它通过调用 clean:clean< 来实现这一点/code>,删除绑定到 ${project.build.directory} 的目录(通常称为“target”)

Maven lets you specify either goals or lifecycle phases on the command line (or both).

clean and install are two different phases of two different lifecycles, to which different plugin goals are bound (either per default or explicitly in your pom.xml)

The clean phase, per convention, is meant to make a build reproducible, i.e. it cleans up anything that was created by previous builds. In most cases it does that by calling clean:clean, which deletes the directory bound to ${project.build.directory} (usually called "target")

过期以后 2024-11-14 16:41:32

你可以使用maven调用多个target目标。 mvn clean install 首先调用 clean,然后调用 install。您必须手动清理,因为清理不是标准的 target 目标,并且不会在每次安装时自动执行。

clean 删除目标文件夹 - 它删除所有类文件、java 文档、jar、报告等。如果你不clean,那么maven只会“做必须做的事情”,就像当相应的源文件没有改变时它不会编译类(简而言之)。

我们在 ant 中将其称为目标,在 maven 中将其称为目标

You can call more than one target goal with maven. mvn clean install calls clean first, then install. You have to clean manually, because clean is not a standard target goal and not executed automatically on every install.

clean removes the target folder - it deletes all class files, the java docs, the jars, reports and so on. If you don't clean, then maven will only "do what has to be done", like it won't compile classes when the corresponding source files haven't changed (in brief).

we call it target in ant and goal in maven

落叶缤纷 2024-11-14 16:41:32

坚持 Maven 术语:

  • “干净”是干净的一个阶段
    生命周期
  • “安装”是
    默认生命周期

http://maven.apache.org/guides /introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference

To stick with the Maven terms:

  • "clean" is a phase of the clean
    lifecycle
  • "install" is a phase of the
    default lifecycle

http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Lifecycle_Reference

眼泪淡了忧伤 2024-11-14 16:41:32

@Andreas_D 也是如此,此外,如果您说将项目中的 Spring 从一个版本更新到另一个版本而不进行清理,那么您最终将在您的工件中得到这两个版本。在使用 Maven 进行 Flex 开发时经常遇到这个问题。

Ditto for @Andreas_D, in addition if you say update Spring from 1 version to another in your project without doing a clean, you'll wind up with both in your artifact. Ran into this a lot when doing Flex development with Maven.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文