在学习springboot搭建新蜜蜂商城的开始,在java-jar命令启动这一步
在终端输入
mvn clean package-Dmaven.test.skip=true
想对刚刚建立的spring-boot项目进行打包 发现打包错误,显示
[INFO] Scanning for projects... [INFO] [INFO] --------------------< ltd.newbee.mall:newbee-mall >--------------------- [INFO] Building newbee-mall 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.292 s [INFO] Finished at: 2022-01-22T22:49:47+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Unknown lifecycle phase "package-Dmaven.test.skip=true". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-ar tifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-c lasses, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integratio n-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, 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
经过搜索发现网上很多错误方法和我的错误方法并不相同,他们是有缩进错误或者末尾多加了一个空格就是多了一个;,而我并没有输入错误,在参考文章:https://www.cnblogs.com/P710078255/p/13851508.html后发现,
可能idea终端用的是cmd命令行模式而非powershall命令行模式,所以导致出现错误,于是输入
mvn clean package install -Dmaven.test.skip=true
打包成功,可喜可贺,第一部成功