简体   繁体   English

无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test)

[英]Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test)

I am facing this issue with 3.0.0-M4.我在 3.0.0-M4 上遇到了这个问题。

I am using jdk1.8.0_222 with maven 3.6.3.我在 maven 3.6.3 中使用 jdk1.8.0_222。

I even tried using maven 3.3.9 with jdk1.8.0_222.我什至尝试将 maven 3.3.9 与 jdk1.8.0_222 一起使用。 I am facing the same issue.我面临同样的问题。

OS: Ubuntu 18.0.4 Maven: 3.6.3, 3.6.0 and 3.3.9 (Tried with these 3 versions. But still seeing issue) Java Version: jdk1.8.0_222操作系统:Ubuntu 18.0.4 Maven:3.6.3、3.6.0 和 3.3.9(尝试了这 3 个版本。但仍然出现问题)Java 版本:jdk1.8.0_222

Can someone please help me on this?有人可以帮我吗? I am not able to proceed further.我无法继续。

My pom.xml is as follows:我的 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>Expertus</groupId>
    <artifactId>Expertus</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>ExpertusONE_4.5</name>
    <description>ExpertusONE_4.5</description>
    <dependencies>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>
        <dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>4.1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.1.1</version>
</dependency>
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>3.0.0-M4</version>
    <scope>test</scope>
</dependency>

    </dependencies>
    <packaging>war</packaging>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>

                </configuration>

            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M4</version>
                <configuration>
                    <useSystemClassLoader>false</useSystemClassLoader>
                    <includes>
                        <include>CreateOrganization.java</include>
                    </includes>
                    <suiteXmlFiles>
                    <suiteXmlFile>/home/nivedab/Desktop/LocalCode/ExpertusONE_4.5/Learning_Suite.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>


        </plugins>


    </build>


    <properties>
        <java.version>1.8.0_222</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

</project>

Jenkins output is as follows:詹金斯输出如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test) on project Expertus: There are test failures. [错误] 无法在 Expertus 项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M4:test (default-test):存在测试失败。

@Nivi First of all, the rule is not to read all what the people write on the Google because they also write bad pages. @Nivi 首先,规则是不要阅读人们在 Google 上写的所有内容,因为他们也写了坏页面。 The right thing is to read the original tutorial from the Apache Maven.正确的做法是阅读 Apache Maven 的原始教程。

Can you read this documentation properly and see all occurences of the word "suiteXmlFiles" on the page https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html that these configuration parameters, you have used in your POM, should not be combined.您能否正确阅读本文档并查看页面https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html上所有出现的“suiteXmlFiles”一词,这些配置参数,您已经使用在您的 POM 中,不应合并。

Next that you use absolute paths completely breaks all what the Maven is about.接下来,您使用绝对路径完全破坏了 Maven 的所有内容。 Your file Learning_Suite.xml should be a realtive path to module's base dir.您的文件Learning_Suite.xml应该是模块基本目录的真实路径。 Therefore it is a resource file and the configuration looks like this <file>src/test/resources/suite.xml</file> in the documentation: https://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html因此,它是一个资源文件,并且文档中的配置如下<file>src/test/resources/suite.xml</file>https : <file>src/test/resources/suite.xml</file> 示例/testng.html

Additionally, the version 1.8.0_222 is something what nobody should use.此外,版本1.8.0_222是任何人都不应该使用的东西。 This is enough and transparent for every POM:这对于每个 POM 来说已经足够且透明了:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<suiteXmlFile>src/test/resources/${suiteXmlFile}.xml</suiteXmlFile>

任何名称都将包含 XML 文件,测试将运行

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未能在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project 从命令行运行 Maven 时“无法执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)” - " Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M1:test (default-test)" while running Maven from command line 无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test):有测试失败 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project: There are test failures 无法在项目测试中执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test):未执行任何测试 - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project testing: No tests were executed 获取错误无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) - Getting ERROR Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project 未能执行目标 org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test 无法在项目myserver上执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(默认测试) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project myserver 无法执行目标org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test(default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) 无法在项目上执行目标 org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project 问题是使用测试 maven,显示此错误 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) - Issue is using test maven, this error is displayed Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM