当前位置: 首页 > 知识库问答 >
问题:

mvn clean install导致surefire错误

裴建华
2023-03-14

我没有对我的项目进行任何更改,但当我运行mvn clean installmvn package时,这些更改都会导致错误

当我在Spring Tool Suit(几乎是Eclipse)中运行这些项目时,它们运行得很好

arya@2OC-2OE:~/Documents/workspace-spring-tool-suite/HelperAPI$ mvn clean install
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building HelperAPI 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ HelperAPI ---
[INFO] Deleting /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ HelperAPI ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ HelperAPI ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 35 source files to /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ HelperAPI ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ HelperAPI ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ HelperAPI ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.411 s
[INFO] Finished at: 2018-10-31T10:50:53-04:00
[INFO] Final Memory: 32M/294M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project HelperAPI: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/arya/Documents/workspace-spring-tool-suite/HelperAPI && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/surefire/surefirebooter3828813415223070401.jar /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/surefire 2018-10-31T10-50-53_064-jvmRun1 surefire8224915599358179621tmp surefire_0529698540830278579tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/arya/Documents/workspace-spring-tool-suite/HelperAPI && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/surefire/surefirebooter3828813415223070401.jar /home/arya/Documents/workspace-spring-tool-suite/HelperAPI/target/surefire 2018-10-31T10-50-53_064-jvmRun1 surefire8224915599358179621tmp surefire_0529698540830278579tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:854)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR]     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR]     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
[ERROR]     at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
[ERROR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR] 
[ERROR] -> [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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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.helperapi</groupId>
    <artifactId>HelperAPI</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>HelperAPI</name>
    <description></description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.6.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
        </dependency>


        <dependency>
            <groupId>net.iakovlev</groupId>
            <artifactId>timeshape</artifactId>
            <version>2018d.5</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

共有1个答案

邢洋
2023-03-14

试着加上这个。当我遇到同样的麻烦时,为我工作:

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.5</version>
        <configuration>
            <skipTests>false</skipTests>
            <testFailureIgnore>true</testFailureIgnore>
            <forkMode>once</forkMode>
        </configuration>
</plugin> 
 类似资料:
  • 我使用mockito 1.8.3、jacoco 0.72和maven 3.0.5 surefire插件(2.12.4)来执行单元测试并生成覆盖报告,它运行良好。 随着越来越多的测试被添加,它开始不工作。在测试执行过程中,我不断地遇到内存不足的错误,并且无法找到一种方法来找出问题所在。

  • 问题内容: 由于某些原因,我的fx:id无法正确绑定到我的类,因此始终会导致错误。 控制者 XML文件 我认为我了解问题的根源,但不了解如何正确解决。根据这个问题的答案,我认为我正在尝试在调用构造函数之前分配FXML元素(并且这些元素只能在初始化期间/之后分配)。 有没有办法 不 执行此操作?还是我犯了一个完全不同的错误? 问题答案: 您使用进口 在您的fxml文件中。 因此,在加载fxml文件时

  • 启用proguard规则后,我在向网络发送任何内容之前遇到以下错误。 java.lang.RuntimeException:无法将FormDocTankPermission转换为RequestBody 引起的 com.fasterxml.jackson.databind.exc.InvalidDefinitionException:找不到类FormDocTankPermission的序列化程序,也

  • 我想我明白我的问题的根源,但我不明白如何正确地解决它。根据这个问题的答案,我认为我试图在调用构造函数之前分配FXML元素(这些元素只能在初始化期间/之后分配)。 有没有一种方法可以在不实现的情况下做到这一点?还是我犯了一个完全不同的错误?

  • 在kotlin引用的属性和字段一节中,写了以下示例: var AllByDefault:int?//错误:需要显式初始化器,隐含默认getter和setter @toniedzwiedz的回答解决了这个问题。这是我的错.我把属性和变量搞错了。

  • 问题内容: 因此,这里是上下文:开发一个ASP.NET MVC 4 Web应用程序,我在数据库中有一个表 ProductAllocations* ,该表由2个外键组成:一个来自我的表 Products ,另一个来自表 Persons 。我有另一个表 Vehicles ,其中包含表 Products 的外键 * 我想选择按产品分组的分配及其信息(一个产品可以分配多次)。这是我的存储过程: 但是,Gr