在没有生命周期阶段或目标的情况下调用 mvn 时,Maven 构建失败 [英] Maven Build Failure when calling mvn without lifecycle phase or goal

查看:54
本文介绍了在没有生命周期阶段或目标的情况下调用 mvn 时,Maven 构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在 Eclipse 上使用 Maven 构建我的项目.第一个构建很棒.之后我收到此错误:

Am try to build my project using Maven on Eclipse. The first build was awesome. After that I get this error :

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.129s
[INFO] Finished at: Wed Nov 28 17:51:35 GST 2012
[INFO] Final Memory: 2M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this 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/NoGoalSpecifiedException

推荐答案

Maven 是一个构建工具,但与 ant 不同,它没有默认"目标.所以当你运行

Maven is a build tool, but unlike ant there is not "default" goal. So when you run

 mvn

您没有提供足够的参数,您需要运行类似

You are not supplying enough arguments, you need to run something like

 mvn test

其中第二个参数表示构建生命周期的位置 你想停下来.然后 Maven 将运行每一步,直到您指定的一步.

Where the second argument indicates where along the build lifecycle you wish to stop. Maven will then run every step up to the one you specified.

一些常见的停止点

 mvn compile (just compile)
 mvn test (compile and run unit tests)
 mvn package (compile, run unit tests, and build the distributable package)
 mvn install (all of the above, and install distributable package into local repository.
     Install is very useful if you need to build other packages which depend on changes
     to this package)
 mvn deploy (all of the above, and install package into remote (aka public) repository
     for sharing with other developers)

这篇关于在没有生命周期阶段或目标的情况下调用 mvn 时,Maven 构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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