【Unknown lifecycle phase “.test.skip=true“. You must specify a valid lifecycle phase】

Unknown lifecycle phase “.test.skip=true”. You must specify a valid lifecycle phase

解决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 <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. 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 没有被正确地识别。

如下图
也可以选择将 IntelliJ IDEA 的终端设置成 CMD 模式(Command Prompt)
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_44188105/article/details/132096969