Maven中的默认生命周期是什么 [英] What is the default lifecycle in Maven

查看:138
本文介绍了Maven中的默认生命周期是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试学习maven,并从 Maven文档

I am trying to learn maven, and going through below statement from Maven docs


有三个内置构建生命周期:默认,清理和站点
默认生命周期处理项目部署,干净的
生命周期处理项目清理,而站点生命周期处理
创建项目的站点文档。

There are three built-in build lifecycles: default, clean and site. The default lifecycle handles your project deployment, the clean lifecycle handles project cleaning, while the site lifecycle handles the creation of your project's site documentation.

以及另一个声明:


默认(或构建):这是用于构建应用程序。

default (or build):This is used to build the application.

我能够运行命令 mvn clean & mvn site 已成功完成。但是当我运行以下命令时,我将获得例外:

I was able to run the commands mvn clean & mvn site successfully. But when I run the below commands then I am getting exceptions:

命令:

mvn default & mvn build

错误详情:

[WARNING] 
[WARNING] Some problems were encountered while building the effective model for org.hibernate.tutorials:hibernate-tutorial:jar:1.0.0-SNAPSHOT
[WARNING] The expression ${artifactId} is deprecated. Please use ${project.artifactId} instead.
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 

[ERROR] Unknown lifecycle phase "build". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException


推荐答案

你没有'全部阅读:


要做所有这些,你只需要调用最后一个构建阶段来执行,在这种情况下,部署:

To do all those, you only need to call the last build phase to be executed, in this case, deploy:



mvn deploy

实际上,默认生命周期包含阶段(按此顺序):

In fact the default lifecycle contains the phases (in that order) :


validate - validate the project is correct and all necessary information is available
compile - compile the source code of the project
test - test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
package - take the compiled code and package it in its distributable format, such as a JAR.
integration-test - process and deploy the package if necessary into an environment where integration tests can be run
verify - run any checks to verify the package is valid and meets quality criteria
install - install the package into the local repository, for use as a dependency in other projects locally
deploy - done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.


您需要在命令行中指定最后一步想要执行,它将执行在此之前和此之前的所有步骤。例如,如果你这样做:

And you need to specify to the command line the last step you want to execute and it will execute all the step that come before this one and this one. For exemple, if you do :

mvn install

它将执行:验证,编译,测试,打包,集成测试,验证和安装(以及其他一些阶段,请参阅完整列表)。

It will execute : validate, compile, test, package, integration-test, verify and install (and some other phases, see complete list).

这篇关于Maven中的默认生命周期是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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