Problem with Maven

I was trying to compile my URCap. Yesterday worked fine, but today it fails.

This is the error that appears:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.21.0:test (default-test) on project WebcamUR: There are test failures.
[ERROR]
[ERROR] Please refer to /home/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR/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/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR/target/surefire/surefirebooter9087312902650887085.jar /home/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR/target/surefire 2018-11-09T09-52-37_822-jvmRun1 surefire2519225174378310344tmp surefire_06672537145143191088tmp
[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/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR/target/surefire/surefirebooter9087312902650887085.jar /home/ur/Desktop/sdk-1.4.4/samples/swing/com.UPV.WebcamUR/target/surefire 2018-11-09T09-52-37_822-jvmRun1 surefire2519225174378310344tmp surefire_06672537145143191088tmp
[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:207)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
[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:307)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
[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] → [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] MojoExecutionException - Apache Maven - Apache Software Foundation

Going to the folder target/surefire-reports:

Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter

Someone knows where is the problem? I think that I didn’t do anything wrong :frowning:

I encountered the same issue today.

Googled the hell out of it, and tried several things. And finally found a solution in the following link.

Change the pom.xml using the guide on Trying to build docker image fails · Issue #150 · prometheus/cloudwatch_exporter · GitHub

Not sure if it is a good fix, or what it does, but it helped me to continue working.

Best regards Jes Peter

4 Likes

Which POM.XML file did you have to change this in? and if it is in your project POM file where did you add it, because mine does not seem to contain the surefire plugin. I am having the same error as mentioned above

Nevermind I figured it out, thanks for the solution!

I have the same problem,could you tell me how you figured it

Hi Chao,

You need to replace some code of your Pom.xml included in an urcap. For example, you may replace this:

		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.6.0</version>
			<configuration>
				<source>1.6</source>
				<target>1.6</target>
			</configuration>
		</plugin>

TO THIS:

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

I don’t think you neceissarily need to replace a section with the “surefire” section.
But inside the POM-file, there is a section called <plugins>.
It is generally like:

<plugins>
   <plugin>
   ... some plugin
   </plugin>
   <plugin>
   ... some other plugin
   </plugin>
</plugins>

In here, you need to add the maven-surefire-plugin.
To make your POM contain this:

<plugins>
   <plugin>
   ... some plugin
   </plugin>
   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.22.1</version>
      <configuration>
          <runOrder>alphabetical</runOrder>
          <useSystemClassLoader>false</useSystemClassLoader>
      </configuration>
   </plugin>
</plugins>
1 Like

i avoided this problem by compiling my code in the terminal with an added command:

mvn install -Dmaven.test.skip=true

rather than just using:

mvn install

It now compiles my caps just fine.

1 Like

@sam.verity-hilton
This is a good fix as well! Also works for me.

1 Like

Yes, technically that works but … it will skip the test step now!
I think that it is not a good idea to skip the test step.
The option for ’ false is much better .
This is also suggested on some java / maven forums as the best solution

@wthomassen
I agree its not a brilliant fix, but it was only temporary whilst the maven bug was fixed, which it is for me now, so I have reverted back to just using

mvn install

Though I never had any problems with caps compiled when the tests were skipped

BTW here is root cause
https://issues.apache.org/jira/browse/SUREFIRE-1588

1 Like

Thank you,I have find the solution,I changed the command as
mvn clean package -Dmaven.test.skip=true
rather than
mvn install
and then it is ok!

1 Like