English 中文(简体)
未能执行关于项目的目标:
原标题:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project

我在几天后试图解决以下错误,但我无法解决:

My module s pom.xml file is:

<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>
    <parent>
        <artifactId>junitcategorizer</artifactId>
        <groupId>com.topdesk.test.junitcategorizer</groupId>
        <version>0.0.1-SNAPSHOT</version>
        <relativePath>..</relativePath>
    </parent>
    <artifactId>junitcategorizer.instrument</artifactId>
    <name>JUnitCategorizer InstrumentationAgent</name>
    <description>The agent used to instrument the called Java classes</description>
    <dependencies>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm-commons</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                        </manifest>
                        <manifestEntries>
                            <Premain-Class>com.topdesk.junitcategorizer.instrument.InstrumentationAgent</Premain-Class>
                            <Agent-Class>com.topdesk.junitcategorizer.instrument.InstrumentationAgent</Agent-Class>
                            <Can-Redefine-Classes>true</Can-Redefine-Classes>
                            <Can-Retransform-Classes>true</Can-Retransform-Classes>
                            <Boot-Class-Path>${project.artifactId}-${project.version}.jar</Boot-Class-Path>
                            <Can-Set-Native-Method-Prefix>true</Can-Set-Native-Method-Prefix>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.5</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <includes>
                                    <include>org.ow2.asm:*</include>
                                </includes>
                            </artifactSet>
                            <relocations>
                                <relocation>
                                    <pattern>org.objectweb.asm</pattern>
                                    <shadedPattern>org.shaded.asm</shadedPattern>
                                </relocation>
                            </relocations>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

我正在犯以下错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12:test (default-test) on project junitcategorizer.instrument: There are test failures.
[ERROR]
[ERROR] Please refer to D:Masters	hesis related papers and toolsjunitcategorizerjunitcategorizer.instrument	argetsurefire-reports for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project junitcategorizer.instrument: There are test failures.

Please refer to D:Masters	hesis related papers and toolsjunitcategorizerjunitcategorizer.instrument	argetsurefire-reports for the individual test results.

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

    Please refer to D:Masters	hesis related papers and toolsjunitcategorizerjunitcategorizer.instrument	argetsurefire-reports for the individual test results.

    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:83)
    at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary(SurefirePlugin.java:673)
    at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:647)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:137)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:98)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 19 more
    [ERROR]
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.

我尝试了以下几个方面,但没有帮助:

  1. mvn dependency::tree
  2. mvn clean install -U or Right-click on "project" Go to "Maven" >> "Update"

请帮助我!

问题回答

This solved my issue. It was 2.10 in my POM, just updated to 2.19.1 and refresh the POM

加入:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
    </plugin>
</plugins>

在您的代码错误中,他发现 urefire plugin。 添加

这是解决问题的:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <testFailureIgnore>true</testFailureIgnore>
    </configuration>
</plugin>

from Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test

当Maven试图在建造jar期间管理测试案例时,就会出现这种情况。 你在你的晚期指挥结束时,可以简单地通过添加<条码>-Dskip 试验s来管理测试案例。

Ex: mvn clean install -DskipTests or mvn clean package -DskipTests

面临同样的问题,我有两个解决办法:

Solution 1: Add surefire plugin reference to pom.xml. Watch that you have all nodes! In my IDEs auto import version was missing!!!

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M3</version>
    </plugin>
</plugins>

<<>Solution2: 我的民主选举学会在档案开始之前增加了错误进口。

附加说明

import org.junit.Test;

我不得不改为

import org.junit.jupiter.api.Test;

ry

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M3</version>
                    <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <shutdown>kill</shutdown> <!-- Use it if required-->
                    </configuration>
                </plugin>

This is a kind of test failure.@SpringBootApplication annotation contains these configurations.

(1) 结构

2) @ComponentScan

3)

@EnableAutoConfiguration是造成这一错误的原因。 这将试图根据您的寄生虫中的依赖情况自动汇合申请。

举例来说,如果你在om子中依赖原始数据-jpa,那么它将设法通过研究申请而增加应用配置。 数据来源的财产档案。 因此,你需要增加数据来源来解决这个问题。

For MySQL :

spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:mysql://localhost/lahiru
spring.datasource.username=root
spring.datasource.password=

Or

你可以通过跳板测试来掩盖这一点。

mvn install -DskipTests

rel=“noreferer”>。

它为我工作了3.0.0-M1版。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M1</version>
</plugin>

You might need to run it with sudo.

I get exactly the same stacktrace when tests fail. More to the top you should see messages identfying the failing test classes. Or go to

D:Masters	hesis related papers and toolsjunitcategorizerjunitcategorizer.instrument	argetsurefire-reports

and have a look at the failure reports. Fix the problems and your build is ok.

好消息: 你的om看起来是ok,Maven可以汇编和执行测试。

解决这一错误的最简单办法是:

(1) 走到你的om子里。

2) 并编辑了像:

<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12</version>
    </plugin>
</plugins>

3) Save the file That s it.

I have the same problem and try almost all these suggestions and another options but nothing works for my case.

So I had run verbose command: (mvn install -X) and saw the problem with Jacoco lib, and finally found this answer that works for me.

将Jacococo的校准版改为我的om。

<groupId>org.jacoco</groupId>
     <artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.4</version>

检查你的测试档案。 你们必须清除项目上的所有试卷错误,并尝试清洁和建设。

If you are using ubantu then try to run MVN with sudo. I got same error for

mvn -Dtest=PerfLatency#latencyTest test -X 

sudo mvn -Dtest=PerfLatency#latencyTest test -X 

解决我的问题

Make sure the name of the class created in the package is something like somethingTest.java Maven only picks the java files ending with Test notation.

我正在发现同样的错误,并在最后添加测试,从而解决了我所有类别的名字。

页: 1 通过指挥或英特尔利j maven工具进行的检测将奏效,但不是解决办法。 解决办法只是在gin后添加。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.0</version>
</plugin>

我也面临同样的问题,我如何看到以下步骤或形象:

  1. Clicked on Windows menu item of eclipse
  2. Clicked on preferences
  3. select Installed JREs
  4. Add your installed jdk s path(JRE home: C:Program FilesJavajdk1.8.0_201jre`)
  5. Add JRE name: jdk1.8.0_201
  6. Clicked on Finish
  7. Apply changes and close

https://i.stack.imgur.com/k09mG.png” rel=“nofollow noreferer”>。

在经过几天的问答之后,我的解决办法是,我放弃在@BeforeEach之前使用@《试验说明》。

我的情况可能有所不同,但我使用 Java11而不是 Java8。

If you re hitting this issue in Eclipse, you can try right click the project > Run as > Maven Install For any missing plugin, add it to your pom.xml file under the plugins section and Run Maven Install again. I hope it helps.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M7</version>
</plugin>

将版本改为2.19.1,对我来说是:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <systemPropertyVariables>
         <xmlOutputDir>${project.build.directory}/surefire</xmlOutputDir>
        </systemPropertyVariables>
    </configuration>
</plugin>`

我面临同样的问题,你在依赖塞伦ium、试验民族、朱伊特的版本中的数字应与你在项目中使用的数字相同。 例如,在你的项目中,你正在使用3.8种硫化物。 在依赖性中应提及这一版本。

 <dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.0.0-beta1</version>
    <scope>test</scope>
</dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
      <version>3.8.1</version>
    </dependency>       
    <dependency>                
      <groupId>org.testng</groupId>                             
      <artifactId>testng</artifactId>                               
      <version>6.8</version>                                
      <scope>test</scope>                                       
    </dependency>   
  </dependencies>

3 years already, but the same thing happened to me and I wanted to contribute with my case. Using the @nikk solution I got better results, but other errors still appeared, although yes, I was allowed to package.

然而,我的任务是执行服务器上的一名同事的守则,在测试环境中,他并没有这样做。 因此,我决定再调查一点,因为守则是实用的,与我毫不相干。

最后,它发现,他的申请将我的片面表插入一个没有的数据库。 解决办法与创建这种数据库一样容易,错误消失。

这个问题可能与已经繁忙的港口有关。 停泊在5005个港口。 因此,你需要确保这一港口是自由的。 如果不加以改变或杀害这一进程。 这一点在英特尔利奇发生了一段时间。

造成这一错误的原因有许多不同,因此每个人都有不同的解决办法。 然而,你自己的网络应用应当对此做出回答。

你们可以看一看它。

/module_with_failure/target/surefire-reports/*.txt

最好在括号中确定定点火-插射版本,否则,包括作为一种依赖性,它将凌驾于可能继承的任何组合(包括档案模式等),例如,使用原始管理方法,从春天诱 Boo-启动者-测试 p。

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.0</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

I 只是调整了黄瓜版本,因为与我的pom文档中的其他黄瓜版本相比,我对日志的依赖程度较低。


<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-java</artifactId>
                <version>6.9.0</version>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-picocontainer -->
            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-picocontainer</artifactId>
                <version>6.9.0</version>
                <scope>test</scope>
            </dependency>
    
            <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
            <dependency>
                <groupId>io.cucumber</groupId>
                <artifactId>cucumber-junit</artifactId>
                <version>6.9.0</version>
                <scope>test</scope>
            </dependency>

I have faced the same problem and try all the method mentioned above. Then I identified that the problem is in the pom file.

so if you have given TestNG.xml in your pom file. Then, Perhaps the location of the TestNG.xml file is not correct.

根据上述指令,它将在总局搜寻档案。 如果您的测验国家.xml文档在其他地方,那么根基目录就可提供这一途径,或者从服务器上复制整个测试国家.xml文档,并贴出。

In my case I have done like below: /home/ubuntu/TestNG.xml

and the problem resolved.

卡雷特案敏感,因此确保了你的档案和手法,并在测试操作员档案中提供包裹。

在经过一段时间的尝试之后,我得以将问题放在深思熟虑的位置上,因为这对未来的人会有助益:

  1. 它与你的<代码>pom.xml文档没有任何关系,不需要任何额外的图书馆或原始资料。

  2. 你们正在找不到报告的地方。 与此类似:

[ERROR] Please refer to /Users/{username}/{folderPath}/{projectName}/target/surefire-reports for the individual test results.
  1. 沿着这条道路lick,走到十字路口。 在文件夹中查询<代码>测试-failed.xml文档并在任何编辑中开放。

  2. 页: 1 页: 1 与此类似:

<class name="PackageName.ClassName">
  1. Go to that file in your IDE and try to run it. If it s failing then fix it and try to run the mvn clean install again.

这个问题应该解决,至少对我来说,应该解决。

我昨天有类似的错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project my-working-tests: There are test failures.

通过以下两个步骤解决了这一错误:

  1. adding the 2.22.1 to the pom.xml fie.
  2. run command mvn -o test

在该步骤中,错误的测试过去了,但我的终点站重犯错误,<代码>。 下一次测试不可能解决“取决于”问题。 之所以如此,是因为指挥系统(mvn -o test)在不下载依赖性的情况下进行脱机测试。 请注意,如果你没有下一次测试,你将不像我所看到的那样遇到同样的新错误。

然后,我再次更换了突击队。 它成功。

请核对第1步的代码

旧法典(错误):

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
           .......
    </configuration>
</plugin>

最新代码(改正错误):

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.1</version>
    <configuration>
           .......
    </configuration>
</plugin>

希望有助于你错误。

HI All can you try adding the below in your POM and then use mvn clean compile and then mvn install.

<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
    <scope>test</scope>
</dependency>




相关问题
Derby gets stuck closing?

I ve got unit tests (in maven) that use derby. At the end of the test run, there is a very long pause, with these log messages before the pause. INFO: Closing Hibernate SessionFactory Nov 16, 2009 8:...

Execute goal on parent after children complete

I have a multi-module maven project (several levels of nesting). Normally, when I execute a maven build (like mvn install or whatever), maven will run all the goals for the parent project before ...

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into ...

Java Equivalent of distcc

Distcc makes it easy to distribute a C or C++ compile job across a number of machines, and is a godsend for working with large, frequently-built codebases. An increasing number of our large projects ...

Maven Assembly Problem

I have a maven multiple-module project, which is giving me headaches in the assembly:assembly phase. I have a module which has an assembly defined in it which works fine when I invoke mvn assembly:...