Unknown lifecycle phase ".=true". You must specify a valid lifecycl

时间:2025-03-27 08:31:39

在PowerShell窗口下执行maven命令行报错:Unknown lifecycle phase “.=true”.

错误信息

[ERROR] Unknown lifecycle phase “.=true”. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. Available lifecycle phases 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-compile, 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 clean install package '-=true'

方法二

不要使用PowerShell命令行模式,使用 cmd 进入命令行执行:mvn clean install package -=true

注意:win10下 Shift+右击 打开的是 PowerShell 窗口,而 PowerShell 窗口下,执行带参数的需要’单引号’包起来才可以