未知的生命周期阶段maven

Rav*_*avi 14 maven-3

我是maven和camel的新手.

我试着在骆驼书中执行这些例子.当我运行以下命令时,我收到此错误.

命令:

mvn test -Dtest= SpringTransformMethodTest
Run Code Online (Sandbox Code Playgroud)

错误:

[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.`
Run Code Online (Sandbox Code Playgroud)

mkl*_*int 26

你和他之间可能有空间.然后将其解释为2个而不是1个.-Dtest=SpringTransformMethodTest

  • @ user2761267如果它适合你,那么你可以勾选这个答案为ACCEPTED. (3认同)

Tar*_*rmo 12

如果参数名称不是单个“单词”,您可能还需要将其括在引号中,如下所示:

mvn gatling:test -D"gatling.simulationClass"="my.package.PostmanSimulation"
Run Code Online (Sandbox Code Playgroud)


Arc*_*nes 10

这个错误也发生在我身上.我正在运行这个命令,mvn的参数之间没有空格安装它的值.

使用此命令:

> 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
Run Code Online (Sandbox Code Playgroud)

我收到了这个错误:

[错误]未知生命周期阶段".oracle".您必须以以下格式指定有效的生命周期阶段或目标:或:[:]:.可用的生命周期阶段包括:验证,初始化,生成源,流程源,生成资源,流程资源,编译,流程类,一般测试源,流程测试源,生成测试资源, 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-干净,干净,后清洁,站点前,站点,站点后,站点部署. - > [帮助1]

通过在每个值中添加双引号来解决问题:

> 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"
Run Code Online (Sandbox Code Playgroud)

[信息]建立成功

  • 如果您使用的是Windows,请不要使用PowerShell - 我在默认的cmd提示符下运气不错 (6认同)
  • 与powershell一起使用但需要双重qoutes (3认同)