Maven Build和Maven安装之间的区别 [英] Difference between Maven Build and Maven install

查看:102
本文介绍了Maven Build和Maven安装之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中使用Maven,当我尝试构建项目时,我看到以下选项:

I'm using Maven in Eclipse and when I try to build my project I see the following options:

  1. 构建
  2. 清洁
  3. 生成源
  4. 安装

Build和install有什么区别?如果可以将构建配置为执行诸如安装"之类的不同目标...为什么我们需要单独的项目?

What is the difference between the Build and install? If build can be configured to execute different goals like "install"...Why do we need separate items?

推荐答案

Maven-简介Build Lifecycle 值得一读.

mvn命令后面的内容可以是构建阶段,也可以是插件目标.

What follows the mvn command can be a build phase, or a plugin goal.

我建议您知道使用不同的目标",而不必太深入.

I would suggest that you know the use of different "goals", without going too deep.

  1. build:我从未见过这样的目标.在我自己的项目中尝试mvn build也会给我错误.
  2. clean:清理输出目标
  3. generate-source:默认生命周期的一个阶段.运行它会执行生命周期的所有阶段,直到generate-source.因此,不会运行编译,打包等操作.
  4. install:默认生命周期的另一个阶段.它将编译,打包您的项目,然后将其安装到本地存储库. (希望您在Maven中拥有本地和远程存储库的概念)
  1. build: I have never seen such goal. Trying mvn build in my own project also gives me error.
  2. clean: cleans up the output targets
  3. generate-source: one phase of the default lifecycle. Running it will do all phases in the lifecycle, until generate-source. Hence, compile, packaging etc is not run.
  4. install: another phase of default lifecycle. It will compile, package your project, and then install it to your local repository. (I hope you have the concept of local and remote repository in Maven)

这篇关于Maven Build和Maven安装之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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