win10下在terminal终端或powershell使用Maven命令打包报错:Unknown lifecycle phase ".test.skip=true"
情景还原
今天在win10中直接在maven项目目录下右键-->terminal终端(或powershell)
,对项目进行打包,执行命令如下:
mvn clean package -Dmaven.test.skip=true
出现如下报错:
[ERROR] Unknown lifecycle phase ".test.skip=true". 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-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
原因:terminal终端或powershell
中,当使用的命令携带参数时,其参数要使用单引号引起来
解决方法
在terminal终端或powershell
中应使用如下命令:
mvn clean package '-Dmaven.test.skip=true'
在cmd终端
中则使用:
mvn clean package -Dmaven.test.skip=true
评论区