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

一时失言乱红尘 2024-03-23 17:59 180阅读 0赞

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终端报错的执行命令

  1. mvn clean install -Dmaven.test.skip=true -P aliyun,prod,scala-2.12,web,fast,flink-1.14

2.0-修改成下面格式后可正确执行

  1. mvn clean install '-Dmaven.test.skip=true' -P aliyun,prod,scala-2.12,web,fast,flink-1.14

从下面报错信息可翻译出,{.test.skip=true}终端把这块当作生命周期了,明显格式有问题

一、报错信息:

  1. [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
  2. 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
  3. 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’}

  1. ## 常规打包
  2. mvn clean install package '-Dmaven.test.skip=true'
  3. ## dinky项目打包-我遇到的maven执行命令
  4. mvn clean install '-Dmaven.test.skip=true' -P aliyun,prod,scala-2.12,web,fast,flink-1.14

三、错误原因和方案

  1. 因为 IntelliJ IDEA 的终端默认使用 PowerShell 来运行命令,
  2. 而在 PowerShell 下,
  3. 参数 -Dmaven.test.skip=true 没有被正确地识别。

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

发表评论

表情:
评论列表 (有 0 条评论,180人围观)

还没有评论,来说两句吧...

相关阅读