idea mvn 打包 Unknown lifecycle phase ".test.skip=true". You must specify a valid lifecycle phase or a goal in the format
解決IntelliJ IDEA下 maven 運行命令 報錯Unknown lifecycle phase ".test.skip=true". You must specify a valid lifecycle phase or a goal in the format。
摘抄:https://blog.csdn.net/loveLifeLoveCoding/article/details/126693376。
感謝:loveLifeLoveCoding。。
一、問題描述:
[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]

二、解決方案
只需要加在此參數外加單引號即可,即:mvn package '-Dmaven.test.skip=true'。
mvn clean install package '-Dmaven.test.skip=true'
三、原因和方案
因為 IntelliJ IDEA 的終端默認使用 PowerShell 來運行命令,而在 PowerShell 下,參數 -Dmaven.test.skip=true 沒有被正確地識別。

也可以選擇將 IntelliJ IDEA 的終端設置成 CMD 模式(Command Prompt)


浙公網安備 33010602011771號