在idea的终端中输入:
mvn clean package-Dmaven.test.skip=true
进行打包
发现报错如下
[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
在网上查了很久,很多错误都不符合我的原因,看到一条说powershall命令行模式无法识别感觉有点靠谱,于是乎使用cmd命令进行打包即:
mvn clean package install -Dmaven.test.skip=true
成功打包,可喜可贺,可喜可贺
解决方案来源:在PowerShell窗口下执行maven命令行报错:Unknown lifecycle phase ".test.skip=true". - BestCoding - 博客园