我有一个基于 Maven 的 Spring MVC 项目。当我右键单击任何项目并单击“构建项目”时,我希望能够触发 Maven 构建。到目前为止,什么也没有发生。但是,如果我右键单击一个项目并单击 Run As...>Maven Build 并提供目标“包”,它会触发 Maven 构建。
当我单击构建项目时,是什么阻止了它运行 Maven 构建。
我有一个基于 Maven 的 Spring MVC 项目。当我右键单击任何项目并单击“构建项目”时,我希望能够触发 Maven 构建。到目前为止,什么也没有发生。但是,如果我右键单击一个项目并单击 Run As...>Maven Build 并提供目标“包”,它会触发 Maven 构建。
当我单击构建项目时,是什么阻止了它运行 Maven 构建。
这只是意味着 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 网站阅读此页面。