解决IntelliJ IDEA下 maven 运行命令 报错Unknown lifecycle phase “.test.skip=true”. You must specify a valid lifecycle phase or a goal in the format
1.0-Idea终端报错的执行命令
mvn clean install -Dmaven.test.skip=true -P aliyun,prod,scala-2.12,web,fast,flink-1.14
2.0-修改成下面格式后可正确执行
mvn clean install '-Dmaven.test.skip=true' -P aliyun,prod,scala-2.12,web,fast,flink-1.14
从下面报错信息可翻译出,{.test.skip=true}终端把这块当作生命周期了,明显格式有问题
[ERROR] Unknown lifecycle phase ".test.skip=true". You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phas
es 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-com
pile, 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]
只需要加在此参数外加英文单引号即可
修改成如下如下格式-{‘-Dmaven.test.skip=true’}
## 常规打包
mvn clean install package '-Dmaven.test.skip=true'
## dinky项目打包-我遇到的maven执行命令
mvn clean install '-Dmaven.test.skip=true' -P aliyun,prod,scala-2.12,web,fast,flink-1.14
因为 IntelliJ IDEA 的终端默认使用 PowerShell 来运行命令,
而在 PowerShell 下,
参数 -Dmaven.test.skip=true 没有被正确地识别。