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

SpringBoot和GitLab CI给maven surefire错误

宰父智敏
2023-03-14

我想用Gitlab CI自动构建我的Spring Boot项目,但它给了我以下错误消息。我已经尝试了一些我在这里找到的解决方案,但没有一个对我有效。当我在本地机器上运行mvn package-b时,它运行时没有任何错误。

[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:  19.432 s
[INFO] Finished at: 2018-11-09T17:38:27Z
[INFO] ------------------------------------------------------------------------   
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project ft-backend: There are test failures.
    [ERROR] 
    [ERROR] Please refer to /builds/festivaltinder/backend/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 /builds/festivaltinder/backend && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /builds/festivaltinder/backend/target/surefire/surefirebooter482613920128694439.jar /builds/festivaltinder/backend/target/surefire 2018-11-09T17-14-53_842-jvmRun1 surefire5530268903330789280tmp surefire_01102852336946345213tmp
    [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 /builds/festivaltinder/backend && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /builds/festivaltinder/backend/target/surefire/surefirebooter482613920128694439.jar /builds/festivaltinder/backend/target/surefire 2018-11-09T17-14-53_842-jvmRun1 surefire5530268903330789280tmp surefire_01102852336946345213tmp
    [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:137)
    [ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
    [ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
    [ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
    [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:56)
    [ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    [ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
    [ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
    [ERROR]     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
    [ERROR]     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
    [ERROR]     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    [ERROR]     at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
    [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] -> [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
    ERROR: Job failed: exit code 
<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>de.tf</groupId>
    <artifactId>ft-backend</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.5.RELEASE</version>
    </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>
        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

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

</project>
maven-build:
    image: maven:3-jdk-8
    stage: build
    script: "mvn package -B"
    artifacts:
        paths:  
            - target/*.jar

共有1个答案

纪鸿禧
2023-03-14

这可能是最近已知的问题。

将此添加到POM中:

        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M1</version>
        </plugin>
 类似资料:
  • 我在摆弄弹力靴,但每向前走一步,就会让我后退两步。 我将我的简单应用程序与Springboot连接在一起,但我没有得到这个错误: 还有这一点: 我不用任何数据库。应用程序非常简单。下面是主要的类: 下面是其他两个类和: 就是这样。尽管它可能很简单。 下面是文件结构以及build.gradle文件内容: 能有人请帮助我让这个小程序运行,指出我在正确的方向,以解决这个问题? 事先好心谢谢你。

  • 我希望当遇到错误时,用户会收到对其http调用的异常响应。该错误确实被捕获并显示在spring日志中,但不会返回给用户。为什么? 我的方法是: 日志中的错误: 错误处理程序: xception.java 例外回复。JAVA 用户收到403。。我不知道为什么,但我应该接受我的错误,没有任何身体。。 InternalServerExc0019在try/catch之外工作。.

  • 大家好,我正试图与下面的声纳整合,这是我面临的错误 未能在项目xxxxx上执行goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar(default-cli):无法从插件'icode'注册扩展名fr.cnes.sonar.plugin.icode.check.icodeSensor:javax/xml/bind/

  • Backend-URL=http://localhost:8080 Frontend-URL=http://localhost:8081 在main.js文件中,我为Axios添加了以下默认值: 在后端站点上,我添加了以下条目:

  • 我正在开发我的第一个springboot应用程序。我在写一本书,一步一步地做每一件事,当我运行这个程序的时候,很少有我无法修复的错误。也许他们很小,但我仍然在努力解决问题,这就是我来这里的原因。 WebStoreAppApplication:

  • org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: The 'JSON_EXTRACT(all_info, '$' property of null is not a List or Array. 关键是这个sql 用navi