Gitlab CI。 mvn验证。无法执行目标

时间:2018-12-25 14:12:43

标签: maven kotlin continuous-integration gitlab

我尝试在本地构建:

mvn -B verify

一切正常。

.gitlab-ci.yml:

image: maven:latest

verify-job:
  script:
    - mvn -B verify

检查了几个模块的Maven之后。我收到错误消息:

[INFO] Tree 1.0-0 ......................................... FAILURE [  7.587 s]

...跳过

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:35 min
[INFO] Finished at: 2018-12-25T13:51:57Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project Tree: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [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/PluginExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :Tree
ERROR: Job failed: exit code 1

没有模块使用依赖项org.apache.maven.plugins:maven-surefire-plugin 我用同样的错误检查了SO的另一个答案,没有人与CI GitLab集成相关。 我可以猜到它与ktlint有关,但是为什么本地构建成功?

1 个答案:

答案 0 :(得分:2)

我找到了解决方案: 只需添加到pom.xml

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