我有一个基于Maven的Spring MVC项目。当我右键单击任何项目并单击“Build Project”时,我希望能够触发Maven构建。截至目前,没有任何反应。但是,如果我右键单击某个项目并单击Run As ...> Maven Build并提供目标“package”,它会触发Maven构建。
当我点击构建项目时,是什么阻止它运行Maven Build。
答案 0 :(得分:0)
这只是意味着maven不知道你想要它做什么。在不指定目标的情况下运行maven构建就像从命令行运行mvn
。这会给你一个错误。
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.263s
[INFO] Finished at: Wed May 29 15:33:36 CAT 2013
[INFO] Final Memory: 2M/76M
[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网站上阅读此page。