【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)
在这里插入图片描述

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值