Tag Archives: LifecyclePhaseNotFoundExceptionUnknown lifecycle phase “mvn”. You must specify a valid lifecycle

Error LifecyclePhaseNotFoundException, Unknown lifecycle phase “mvn”. You must specify a valid lifecycle

Unknown lifecycle phase “”. 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-site, site, post-site, site-deploy, pre-clean, clean, post-clean. -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1]http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException

Reason 1:

Using Eclipse Maven plug-in [Run As]-[Maven build] did not specify a goal or phase for it
Solution.
Find the <build> node in pom.xml, add <defaultGoal>compile</defaultGoal> to it

Reason 2:

Using Eclipse Maven plugin [Run As]-[Maven build] with more mvn commands
Because the Eclipse Maven plugin has already prefixed the mvn command for you, manually outputting a command like mvn clean install will become mvn mvn clean install