问题
I am new to maven and camel.
I tried executing the examples in camel book. And I am getting this error when I run the following command.
Command:
mvn test -Dtest= SpringTransformMethodTest
Error:
[ERROR] Unknown lifecycle phase "SpringTransformMethodTest". You must specify a valid lifecycle phase or a goal in the f
ormat <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle ph
ases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, proce
ss-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, ver
ify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [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.`
回答1:
you have likely a space between -Dtest=
and SpringTransformMethodTest
. That's then interpreted as 2 items instead of one.
回答2:
This error has happened to me as well. I was running this command which hasn't spaces between the parameters of mvn install its values.
With this command:
> mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file
-Dfile=C:\Users\arcones\Desktop\ojdbc7.jar
-DgroupId=com.oracle
-DartifactId=ojdbc7
-Dversion=12.1.0.1
-Dpackaging=jar
-DlocalRepositoryPath=lib
I got this error:
[ERROR] Unknown lifecycle phase ".oracle". 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, genera te-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-class es, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, depl oy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
The problem got resolved by adding double quotes to each value:
> mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file
-Dfile="C:\Users\arcones\Desktop\ojdbc7.jar"
-DgroupId="com.oracle"
-DartifactId="ojdbc7"
-Dversion="12.1.0.1"
-Dpackaging="jar"
-DlocalRepositoryPath="lib"
[INFO] BUILD SUCCESS
回答3:
If the parameter name is not a single 'word' you might also need to enclose it in quotation marks like this:
mvn gatling:test -D"gatling.simulationClass"="my.package.PostmanSimulation"
回答4:
Accidentially typing:
mvn packgage
Instead of:
mvn package
Yeilds/Results In:
[ERROR] Unknown lifecycle phase "packgage". [ ...etc...]
Stack: GitBash+Windows10+Maven3.5.4
来源:https://stackoverflow.com/questions/18697461/unknown-lifecycle-phase-maven