【问题标题】:Spring Boot Application - Maven IssueSpring Boot 应用程序 - Maven 问题
【发布时间】:2019-07-25 12:30:48
【问题描述】:

不久前我正在开发一个应用程序,经过长时间的刹车后,我重新打开它并尝试更改某些内容并构建应用程序。

现在当我尝试构建应用程序时,我遇到了 Maven 问题

请您看看错误并支持我,我应该更改/添加什么?

我第一次看到这个问题,真的不知道哪里出了问题,尤其是一个月前它运行良好。

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.641 s
[INFO] Finished at: 2019-03-04T09:02:26+01:00
[INFO] Final Memory: 24M/464M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project myapplication: There are test failures.
[ERROR] 
[ERROR] Please refer to D:\JAVA\JAVA\JAVA\JAVA\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 cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130\surefirebooter5461745518324810198.jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130 2019-03-04T09-02-23_668-jvmRun1 surefire5550337711472069686tmp surefire_01955205028093789027tmp"
[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 cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130\surefirebooter5461745518324810198.jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130 2019-03-04T09-02-23_668-jvmRun1 surefire5550337711472069686tmp surefire_01955205028093789027tmp"
[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.cli.MavenCli.main(MavenCli.java:199)
[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] at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project myapplication: There are test failures.

Please refer to D:\JAVA\JAVA\JAVA\JAVA\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130\surefirebooter5461745518324810198.jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130 2019-03-04T09-02-23_668-jvmRun1 surefire5550337711472069686tmp surefire_01955205028093789027tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130\surefirebooter5461745518324810198.jar C:\Users\user\AppData\Local\Temp\surefire3153501061038019130 2019-03-04T09-02-23_668-jvmRun1 surefire5550337711472069686tmp surefire_01955205028093789027tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
    ....
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    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:498)
    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)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: There are test failures.

测试是:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project application: There are test failures.
[ERROR] 
[ERROR] Please refer to D:\JAVA\JAVA\JAVA\JAVA\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 cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241\surefirebooter706544173501739081.jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241 2019-03-04T09-28-58_374-jvmRun1 surefire700658503828727378tmp surefire_09037920200833720438tmp"
[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 cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241\surefirebooter706544173501739081.jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241 2019-03-04T09-28-58_374-jvmRun1 surefire700658503828727378tmp surefire_09037920200833720438tmp"
[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 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] at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project application: There are test failures.

Please refer to D:\JAVA\JAVA\JAVA\JAVA\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241\surefirebooter706544173501739081.jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241 2019-03-04T09-28-58_374-jvmRun1 surefire700658503828727378tmp surefire_09037920200833720438tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241\surefirebooter706544173501739081.jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241 2019-03-04T09-28-58_374-jvmRun1 surefire700658503828727378tmp surefire_09037920200833720438tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)
    at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1149)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:978)
    ...
    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:498)
    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)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: There are test failures.

Please refer to D:\JAVA\JAVA\JAVA\JAVA\target\surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241\surefirebooter706544173501739081.jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241 2019-03-04T09-28-58_374-jvmRun1 surefire700658503828727378tmp surefire_09037920200833720438tmp"
Error occurred in starting fork, check output in log
Process Exit Code: 1
org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was cmd.exe /X /C ""C:\Program Files\Java\jdk1.8.0_181\jre\bin\java" -jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241\surefirebooter706544173501739081.jar C:\Users\user\AppData\Local\Temp\surefire1234626952071494241 2019-03-04T09-28-58_374-jvmRun1 surefire700658503828727378tmp surefire_09037920200833720438tmp"
Error occurred in starting fork, check output in log

我看到的内部日志文件

# Created on 2019-03-04T09:29:00.628
Killing self fork JVM. Maven process died.

【问题讨论】:

  • "有测试失败" 所以运行测试看看。鉴于这些信息很少,我们无法为您提供除此之外的帮助。
  • 以下消息也相关:“请参阅 D:\JAVA\JAVA\JAVA\JAVA\target\surefire-reports 以获取个别测试结果”
  • 有测试失败。 - 修复测试或删除它们。
  • mvn 不管什么 -DskipTests
  • 如何在 Intellij 中跳过测试?我知道我可以在 cmd 中调用命令,但直到现在它在 Intellij 中都可以正常工作

标签: java maven spring-boot maven-3


【解决方案1】:

从终端:

-DskipTests 添加到mvn 命令作为解决方法。例如:

mvn package -DskipTests

这可以很好地构建包。

从 IntelliJ 中,就像您提到的那样,您可以执行以下操作:

View > Tool Windows > Maven Projects 单击名为 Skip Tests Mode 的按钮。本质上,当您说运行包时,它会将测试阶段从生命周期中移除。

我希望它暂时有所帮助,除非测试用例的问题得到解决。

【讨论】:

  • 我认为这是个坏建议。只是跳过失败的测试是自找麻烦。测试失败肯定是有原因的。
猜你喜欢
  • 1970-01-01
  • 2021-01-07
  • 2020-10-19
  • 2020-01-09
  • 2020-08-28
  • 2020-07-13
  • 1970-01-01
  • 2021-01-14
  • 2019-07-24
相关资源
最近更新 更多