问题描述
在VS Code中创建的Java Maven项目,在进行项目打包时,遇见 BUILD FAILURE
\lbimage> mvn -clean package [INFO] Scanning for projects... [INFO] [INFO] ----------------< org.yourcompany.yourproject:lbimage >----------------- [INFO] Building lbimage 1.0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.154 s [INFO] Finished at: 2024-11-01T17:44:40+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Unknown lifecycle phase "lean". 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: pre-clean, clean, post-clean, 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. -> [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 |
错误截图
问题解答
根据错误信息,输入的指令中的内容不在Maven的有效生命周期中。应该输入正确的指令,如: clean, test, initialize, package 等提示信息中列举的值。
而在本次错误中,输入的打包指令时 mvn -clean package,对比后发现,多输入了一个“-”。 正确的指令为:mvn clean package
参考资料
Maven project failed in eclipse and command line : https://stackoverflow.com/questions/61283849/maven-project-failed-in-eclipse-and-command-line
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!