Reputation: 33
I am new to jenkins.When I try to build a maven project, I meet an exception.
[ERROR] Unknown lifecycle phase "mvn". 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 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]
How can I deal with it? Thanks
Upvotes: 1
Views: 9117
Reputation: 31
problem : You provide commands in goal
Goal : test verify -Dcucumber.options=”--tags @AddPlace”
then you get error: LifecyclePhaseNotFoundException
solution: Your double quotes are different and correct it .provide command like this
Goal :test verify -Dcucumber.options="--tags @AddPlace"
Upvotes: 0
Reputation: 1
Unknown lifecycle phase perform-whitesource-scan
getting this in configuration giving:
clean deploy perform-whitesource-scan -Dwhitesource.scan.project.version=$POM_VERSION -Dws_ver=$POM_VERSION -P Sydney
Upvotes: 0
Reputation: 581
In my case, the error was like this:
[ERROR] Unknown lifecycle phase ".1". 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 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]
The reason I found for this is I wrote -Dversion=1.1
and not -Dversion="1.1"
.
This is why it was showing an error.
I was trying to execute the following command in the .gitlab-ci.yml file:
script:
- 'mvn -X -e org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file -Dfile="C:\Gitlab-Runner\builds\BAMAEMCW\0\hridoy\maven-project-with-ci-cd\lib\json-simple-1.1.jar" -DgroupId=json-simple -DartifactId=json-simple -Dversion="1.1" -Dpackaging=jar'
Now, it executes without any error. I think in your case, check if any typos occurred!
Upvotes: 0
Reputation: 101
Error: org.apache.maven.lifecycle.LifecyclePhaseNotFoundException 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
Solution : Unknown lifecycle phase or wrong goal example:First I am using "clean package tea-container-test:tomcat-test -P "XXX" -e" as goal , then I changed a goal as "test -P XXX" , then It works perfectly,so Please check , your goal is right or wrong. "Creates a new exception to indicate that the specified lifecycle phase is not defined by any known lifecycle".
Upvotes: 0
Reputation: 27505
I think what happened is that when you setup the Maven build step, you wrote mvn somegoal
The maven build step already implies the mvn
command. So, in the goals section only write the goal. Don't explicitly write the mvn
command.
Upvotes: 1