Java 目标 org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process 执行 default-tes
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45156662/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process
提问by Soumyansh Gupta
I am getting this error while doing install from Maven:
从 Maven 安装时出现此错误:
Steps - Maven clean -- Running fine Maven Install - "[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project com.learn.selenium: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an error in the forked process"
步骤 - Maven 清洁 - 运行良好的 Maven 安装 - “[错误] 无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project com.learn.selenium: Execution目标 org.apache.maven.plugins:maven-surefire-plugin:2.17:test 的默认测试失败:分叉过程中出现错误”
I am a newbie to Selenium
, any help would be really appreciated, below is my POM xml
我是新手Selenium
,任何帮助将不胜感激,下面是我的 POM xml
**<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.learn</groupId>
<artifactId>com.learn.selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>demo</name>
<description>demo</description>
<properties>
<suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.40.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>2.18.1</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>**
采纳答案by Anshul Sharma
i think, you need to upgrade maven-surefire-plugin
version to 2.19.1
, if you are properly create suiteXmlFile
. and need to specify the actual path of suiteXmlFile
, for Example : <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
. and if you want to use <suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
, you need to run mvn clean install test -DsuiteXmlFile=testngSuite.xml
.
for more you can refer bellow links(maven-surefire-plugin document):
我想,你需要升级maven-surefire-plugin
的版本2.19.1
,如果你正确地创建suiteXmlFile
。并且需要指定 的实际路径suiteXmlFile
,例如: <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
。如果您想使用<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
,则需要run mvn clean install test -DsuiteXmlFile=testngSuite.xml
. 有关更多信息,您可以参考以下链接(maven-surefire-plugin 文档):
http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html
http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html
http://www.seleniumeasy.com/maven-tutorials/how-to-execute-selenium-webdriver-testng-xml-using-maven
http://www.seleniumeasy.com/maven-tutorials/how-to-execute-selenium-webdriver-testng-xml-using-maven