我正在使用Appium测试自动化框架,我想将其上传到AWS Device Farm。我更新了pom.xml和zip.xml文件。当我运行命令'mvn clean package --DskipTests = true'时,我收到以下错误。
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building 1 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.109 s
[INFO] Finished at: 2016-07-25T14:54:43+05:30
[INFO] Final Memory: 7M/77M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "?-DskipTests=true". You must specify a valid li
fecycle 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, p
rocess-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-cle
an, pre-site, site, post-site, site-deploy. -> [Help 1]
任何人都可以给我一个解决方案吗?以前我得到的mvn不被认可为内部或外部命令,所以我分别安装了maven ..请帮忙
答案 0 :(得分:1)
如果您输入:
mvn -h
您将获得Maven的帮助页面打印到控制台中。你会看到它说:
usage: mvn [options] [<goal(s)>] [<phase(s)>]
所以,试试这个:
mvn -DskipTests package
即忘记“= true”位。
警告:请注意您从中复制和粘贴的位置。我从Github README.md文件中复制了它,它让我失去了一个小时。那里有一些错字,所以很难看到它们很微妙。
使用减号/连字符“ - ”符号(ASCII代码45),将起作用:
mvn -DskipTests package
这用短划线“ - ”(ASCII代码150)不起作用:
mvn –DskipTests package
因此,如果您一直粘贴到命令行并且不断尝试使用未知生命周期阶段“-DskipTests”错误,只需输入它以确保使用减号/连字符。
答案 1 :(得分:0)
mvn plugin-prefix:goal或plugin-group-id:plugin-artifact-id:plugin-version:goal
以上内容应该在您的POM.xml文件中可用 例如:
--------------
<groupId>com.aws.appium</groupId>
<artifactId>appium-android-test</artifactId>
<version>1.0-SNAPSHOT</version>
-------------
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
答案 2 :(得分:0)
确保所有maven依赖项都应包含在pom.xml中。
然后转到存在pom.xml的项目文件夹,并在终端中输入以下命令:
mvn clean package -DskipTests = true
就是这样。
答案 3 :(得分:0)
您没有为maven build指定目标。
在maven构建的运行配置中,如clear,compile,install,package。
请按照以下步骤解决。
right click on your project.
click 'Run as' and select 'Maven Build'
edit Configuration window will open. write any goal but your problem specific write 'package' in Goal text box.
click on 'Run'