# Problem with Maven

**URL:** <https://forum.universal-robots.com/t/problem-with-maven/3076>\
**Category:** Technical Questions\
**Tags:** bugs\
**Created:** [November 9, 2018, 5:54pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076 "2018-11-09T17:54:40Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon23279734](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@anon23279734](https://forum.universal-robots.com/u/anon23279734)\
**Post date:** [November 9, 2018, 5:54pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/1 "2018-11-09T17:54:40Z")

</div>

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](http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException)

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 ☹

---

<div class="post-metadata">

**Author:** ![anon84240129](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@anon84240129](https://forum.universal-robots.com/u/anon84240129)\
**Post date:** [November 9, 2018, 10:19pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/2 "2018-11-09T22:19:06Z")

</div>

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](https://github.com/prometheus/cloudwatch_exporter/issues/150)

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

Best regards Jes Peter

---

<div class="post-metadata">

**Author:** ![anon44882538](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@anon44882538](https://forum.universal-robots.com/u/anon44882538)\
**Post date:** [November 13, 2018, 5:25pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/3 "2018-11-13T17:25:02Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon44882538](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@anon44882538](https://forum.universal-robots.com/u/anon44882538)\
**Post date:** [November 13, 2018, 7:30pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/4 "2018-11-13T19:30:11Z")

</div>

Nevermind I figured it out, thanks for the solution!

---

<div class="post-metadata">

**Author:** ![anon25545047](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon25545047](https://forum.universal-robots.com/u/anon25545047)\
**Post date:** [November 14, 2018, 6:23am UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/5 "2018-11-14T06:23:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon23279734](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@anon23279734](https://forum.universal-robots.com/u/anon23279734)\
**Post date:** [November 14, 2018, 9:41am UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/6 "2018-11-14T09:41:33Z")

</div>

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>
```

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [November 14, 2018, 11:53am UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/7 "2018-11-14T11:53:25Z")

</div>

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:

```auto
<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:

```auto
<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>

```

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [November 14, 2018, 2:33pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/8 "2018-11-14T14:33:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbm](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/jbm/32/614_2.png) [@jbm](https://forum.universal-robots.com/u/jbm)\
**Post date:** [November 14, 2018, 2:37pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/9 "2018-11-14T14:37:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon12495347](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anon12495347](https://forum.universal-robots.com/u/anon12495347)\
**Post date:** [November 14, 2018, 2:49pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/10 "2018-11-14T14:49:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sam.verity-hilton](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sam.verity-hilton/32/6046_2.png) [@sam.verity-hilton](https://forum.universal-robots.com/u/sam.verity-hilton)\
**Post date:** [November 14, 2018, 2:59pm UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/11 "2018-11-14T14:59:25Z")

</div>

@anon12495347  
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

---

<div class="post-metadata">

**Author:** ![osh](https://avatars.discourse-cdn.com/v4/letter/o/dc4da7/32.png) [@osh](https://forum.universal-robots.com/u/osh)\
**Post date:** [November 19, 2018, 8:50am UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/12 "2018-11-19T08:50:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anon25545047](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@anon25545047](https://forum.universal-robots.com/u/anon25545047)\
**Post date:** [November 21, 2018, 6:38am UTC](https://forum.universal-robots.com/t/problem-with-maven/3076/13 "2018-11-21T06:38:58Z")

</div>

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!
