Maven Test Throws Exception in Ubuntu - maven

Since an event I do not know, calling mvn test does not work anymore in my Ubuntu 18.04. (running since April). mvn install -DskipTests=true or any other lifecycle phase I tried works well.
If I run for example mvn test in a recent version of Apache Commons IO cloned into /home/reichelt/commons-io/, if shows
[ERROR] ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was /bin/sh -c cd /home/reichelt/commons-io && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx25M -jar /home/reichelt/commons-io/target/surefire/surefirebooter6661636703131088733.jar /home/reichelt/commons-io/target/surefire 2018-10-31T18-30-50_926-jvmRun1 surefire4405197448341812663tmp surefire_1048154306090710821475tmp
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:494)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkPerTestSet(ForkStarter.java:441)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:293)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[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:208)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[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:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
[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] Caused by: 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/reichelt/commons-io && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Xmx25M -jar /home/reichelt/commons-io/target/surefire/surefirebooter6661636703131088733.jar /home/reichelt/commons-io/target/surefire 2018-10-31T18-30-50_926-jvmRun1 surefire4405197448341812663tmp surefire_1048154306090710821475tmp
[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.access$600(ForkStarter.java:115)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:429)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter$2.call(ForkStarter.java:406)
[ERROR] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[ERROR] at java.lang.Thread.run(Thread.java:748)
The target/surefire-reports contains many repetitions of
# Created on 2018-10-31T18:31:48.243
Error: Could not find or load main class org.apache.maven.surefire.booter.ForkedBooter
Any other project I tried shows similiar behaviour.
I tried downloading maven 3.5.4, unzipping it, adding it to the path by export PATH=/home/reichelt/Downloads/apache-maven-3.5.4-bin/apache-maven-3.5.4/bin:$PATH and running the newer version, but this did not change anything (while mvn -version works correctly and shows the newer version). Same happens for Maven 3.5.0.
Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher suggests that setting export M3_HOME=/usr/share/maven and export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ should help, but unfortunately, it did not.
I tried deleting ~/.m2, but unfortunately, this also did not help.
Running this in a docker container with docker run -it ubuntu and running
apt update
apt install -y openjdk-8-jdk maven git
mvn -version
git clone https://github.com/apache/commons-io.git
cd commons-io/
mvn test
yields the same behaviour, so it seems like this is not only an issue of my installation.
Running docker run -it fedora bash and
yum install java-1.8.0-openjdk.x86_64*
yum install wget
wget http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
tar -xvf apache-maven-3.5.4-bin.tar.gz
yum install git
export PATH=/apache-maven-3.5.4/bin:$PATH
mvn -version
git clone https://github.com/apache/commons-io.git
cd commons-io/
mvn test
runs the tests as expected surprisingly.
Has anybody an idea how to solve this issue / work around it?
EDIT
Like the message suggests, this seems to be a problem with the ForkedBooter which can not be found. https://maven.apache.org/surefire/maven-surefire-plugin/examples/class-loading.html describes that surefire can be used by an isolated classloader in a booter jar, or by an manifest-only jar. It seems like by default, I am using a manifest only jar which contains something like:
Manifest-Version: 1.0
Class-Path: file:/home/reichelt/.m2/repository/org/apache/maven/surefi
re/surefire-booter/2.21.0/surefire-booter-2.21.0.jar file:/home/reich
elt/.m2/repository/org/apache/maven/surefire/surefire-api/2.21.0/sure
fire-api-2.21.0.jar file:/home/reichelt/.m2/repository/org/apache/mav
en/surefire/surefire-logger-api/2.21.0/surefire-logger-api-2.21.0.jar
file:/home/reichelt/commons-io/target/test-classes/ file:/home/reich
elt/commons-io/target/classes/ file:/home/reichelt/.m2/repository/jun
it/junit/4.12/junit-4.12.jar file:/home/reichelt/.m2/repository/org/h
amcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar file:/home/reichelt/.
m2/repository/org/apache/maven/surefire/surefire-junit4/2.21.0/surefi
re-junit4-2.21.0.jar
Main-Class: org.apache.maven.surefire.booter.ForkedBooter
This seems fine to me: /home/reichelt/.m2/repository/org/apache/maven/surefire/surefire-booter/2.21.0/surefire-booter-2.21.0.jar is fine and contains a class file for org.apache.maven.surefire.booter.ForkedBooter.
By adding
<useSystemClassLoader>true</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
to the pom, builds run again. This seems to be a solution which makes no use of the ForkedBooter. While this is a workaround, I'd still like to understand: Can I further debug this issue, in order to find a reason while this does not work with current Ubuntu? Since it does not work with other maven versions (even in a fresh Ubuntu docker container), but does work on a Fedora container, I assume that the reason somehow is connected to the Ubuntu default configuration.

Funny story: Indeed, this was an OpenJDK update issue.
I read my last history by sudo zcat /var/log/apt/history.log.1.gz | less (depending on logrotating, it was .1, could be anything else). This showed that an update was run this morning:
Start-Date: 2018-10-31 10:38:04
Commandline: /usr/bin/unattended-upgrade
Upgrade: openjdk-8-jdk:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1), openjdk-8-jre:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1), openjdk-8-jdk-headless:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1), openjdk-8-jre-headless:amd64 (8u181-b13-0ubuntu0.18.04.1, 8u181-b13-1ubuntu0.18.04.1)
End-Date: 2018-10-31 10:38:09
So for some reason, OpenJDK 8u181 seems to be incompatible with maven 3.5.2 and surefire. Since I already installed the package upgrade, I downgraded again with sudo apt install openjdk-8-jdk=8u162-b12-1 openjdk-8-jre=8u162-b12-1 openjdk-8-jdk-headless=8u162-b12-1 openjdk-8-jre-headless=8u162-b12-1. Now testing works again.
In https://www.oracle.com/technetwork/java/javase/8u-relnotes-2225394.html, there Java 8u171, 8u172 and 8u181 do not seem to contain updates which make using the maninfest-only jar of surefire impossible, but I only looked shortly above it and did not dive deeper into the bug reports.
EDIT The bug is already reported on OpenJDK: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=911925
EDIT 2 This bug is fixed in Java 1.8.0_191 and mvn test runs normal again.

Ran into the same problem today. Not sure of the best long-term fix, but setting the forkCount to 0 for maven-surefire-plugin seems to have fixed it for me for now. Probably makes the tests take longer, unfortunately.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkCount>0</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
Hope it helps.

Related

Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'

Our Jenkins has a Maven/Tycho build using Java8 that worked perfectly in February, but stopped working now in April. (Since it was not run during this interval, I'm not sure when it stopped working exactly.)
The exception that gets thrown right after downloading the p2 repositories (or maybe right in the middle) is:
[WARNING] Error initializing: org.eclipse.tycho.p2.resolver.P2DependencyResolver#18bef28
java.lang.RuntimeException: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.checkStarted (DefaultEquinoxEmbedder.java:312)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:286)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:281)
at org.eclipse.tycho.p2.resolver.P2DependencyResolver.initialize (P2DependencyResolver.java:429)
Caused by: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:302)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.getService (DefaultEquinoxEmbedder.java:281)
at org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.afterFrameworkStarted (OSGiProxyConfigurator.java:41)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.doStart (DefaultEquinoxEmbedder.java:185)
...and...
[WARNING] Error injecting: org.eclipse.tycho.p2.resolver.P2DependencyResolver
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) Error notifying InjectionListener org.eclipse.sisu.plexus.PlexusBeanBinder#1b6fe69 of org.eclipse.tycho.p2.resolver.P2DependencyResolver.
Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
while locating org.eclipse.tycho.p2.resolver.P2DependencyResolver
1 error
at com.google.inject.internal.InternalProvisionException.toProvisionException (InternalProvisionException.java:226)
at com.google.inject.internal.InjectorImpl$1.get (InjectorImpl.java:1053)
at com.google.inject.internal.InjectorImpl.getInstance (InjectorImpl.java:1086)
at org.eclipse.sisu.space.AbstractDeferredClass.get (AbstractDeferredClass.java:48)
...and of course...
[ERROR] Internal error: java.lang.RuntimeException: Could not instantiate required component: com.google.inject.ProvisionException: Unable to provision, see the following errors:
[ERROR]
[ERROR] 1) Error notifying InjectionListener org.eclipse.sisu.plexus.PlexusBeanBinder#1b6fe69 of org.eclipse.tycho.p2.resolver.P2DependencyResolver.
[ERROR] Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is not registered class='interface org.eclipse.tycho.core.shared.ProxyServiceFacade'
[ERROR] while locating org.eclipse.tycho.p2.resolver.P2DependencyResolver
[ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:1.3.0, parent: sun.misc.Launcher$AppClassLoader#647e05] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule)
[ERROR] while locating org.eclipse.tycho.core.DependencyResolver annotated with #com.google.inject.name.Named(value=p2)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.eclipse.tycho.core.DependencyResolver
[ERROR] roleHint: p2
[ERROR] -> [Help 1]
My first thought was that Maven takes new releases of it's plug-ins, but there are no versions missing in the pom.xml and Maven does not warn about it either.
I tried updating from Tycho 0.22 to 0.26 to 1.3, but neither version worked.
I tried running the build with Maven 3.0 and 3.6, but neither worked.
I tried Java 8 with 32bit and 64bit, and Java 11.
Now I have no idea where to even start to search for the source of the problem. Can anyone shed some light on this?
(If you need some more information, just ask. The files are pretty long, so I'd rather not copy all of them into this question before narrowing down where the problem might be.)
It helped for me to clean local maven repository.
Normally its located in <User-home>/.m2
HTH
I think I have similar setup as yours: An Eclipse RCP project which should be build on Jenkins in a Docker container by Maven/Tycho.
The following issue gave me a hint in the right direction: https://bugs.eclipse.org/bugs/show_bug.cgi?id=552877
When I ran Maven with -X I got the following debug-output:
[DEBUG] Using local repository at ?/.m2/repository
This led me to the following question: Why does maven use "?" as my home directory
But additionally to the -s argument I also needed to set the user.home parameter explicitly. (But that is probably only needed because I have not set the local repository location in the settings.xml)
This finally results in this Maven call: mvn -B clean verify --fail-at-end -s /some/folder/settings.xml -Duser.home=/another/folder

Building hadoop keeps failing, even though protoc 2.5.0 is set on my system

I am now trying to build hadoop using mvn after I finished its prerequisites.
However, I get this message even though I have right version of protoc.
I tried to rebuild protoc 2.5.0 several times already and every time all the tests of it would be passed and build successfully. I don't know why this keeps happening, Please help. Thanks.
[ERROR] Failed to execute goal
org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc
(compile-protoc) on project hadoop-common:
org.apache.maven.plugin.MojoExecutionException: protoc failure ->
[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] [ERROR] After correcting the problems, you can resume the
build with the command [ERROR] mvn <goals> -rf :hadoop-common
TJ#DESKTOP-6940Q5M /cygdrive/e/hdc
$ protoc --version
libprotoc 2.5.0
Thanks for the advice that I missed to upload the display on the re-run with -e switch. Here it is.
Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: protoc failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.hadoop:hadoop-maven-plugins:3.0.0-SNAPSHOT:protoc (compile-protoc) on project hadoop-common: org.apache.maven.plugin.MojoExecutionException: protoc failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
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:497)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: org.apache.maven.plugin.MojoExecutionException: protoc failure
at org.apache.hadoop.maven.plugin.protoc.ProtocMojo.execute(ProtocMojo.java:105)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.apache.maven.plugin.MojoExecutionException: protoc failure
at org.apache.hadoop.maven.plugin.protoc.ProtocMojo.execute(ProtocMojo.java:102)
... 22 more
I really don't know what its problem is since I am a starter with hadoop.
Please help.
The hadoop maven protobuf compiler is, sadly, useless when there's an error.
This could just be some error in the .protoc files which isn't being reported as such, instead mvn is just failing without showing the root cause.
I end up debugging compilation problems by using the protoc command line tool.
Seems you need to install protobuf-compiler. Then build hadoop-maven-plugins. The go back to hadoop source code parent directory and execute maven goal
cd <hadoop_source_path>
sudo yum install protobuf-compiler
cd hadoop-maven-plugins
mvn install
cd ..
mvn package -skipTests
This worked for me.

sonar maven plugin build error, SonarQube version: null

My jenkins builds just started to fail with this message:
[INFO] --- sonar-maven-plugin:2.7:sonar (default-cli) # cividas-core-web ---
[INFO] artifact com.ontimize:ontimize-core: checking for updates from central
[INFO] artifact com.ontimize:ontimize-core: checking for updates from imatia-local
[INFO] artifact com.ontimize:ontimize-core: checking for updates from snapshots
[INFO] User cache: /var/lib/jenkins/.sonar/cache
[INFO] SonarQube version: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.773s
[INFO] Finished at: Thu Oct 22 19:49:04 CEST 2015
[INFO] Final Memory: 13M/193M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project cividas-core-web: null: MojoExecutionException: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project cividas-core-web: null
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException
at org.codehaus.mojo.sonar.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:41)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:107)
at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:141)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.maven.artifact.versioning.ComparableVersion.parseVersion(ComparableVersion.java:354)
at org.apache.maven.artifact.versioning.ComparableVersion.<init>(ComparableVersion.java:345)
at org.apache.maven.artifact.versioning.DefaultArtifactVersion.parseVersion(DefaultArtifactVersion.java:110)
at org.apache.maven.artifact.versioning.DefaultArtifactVersion.<init>(DefaultArtifactVersion.java:46)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.isVersionPriorTo5Dot2(RunnerBootstrapper.java:192)
at org.codehaus.mojo.sonar.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:84)
... 22 more
[ERROR]
[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
Sonar analysis completed: FAILURE
What is this all about?
Solved by downgrading the automatically picked latest (2.7) version to an older one (2.4) by adding this code to the plugins section of my pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.4</version>
</plugin>
For those interested in "why?", I've done some more digging and what seems to be happening is this:
RunnerBootstrapper attempts to check whether a version is 5.2+:
First, serverVersion is retrieved from a launcher created in EmbeddedRunner,
using IsolatedLauncher creating a proxy of implementation class BatchIsolatedLauncher
which attempts to read a resource file sq-version.txt containing the version.
This sq-version.txt file is located in org.codehaus.sonar:sonar-plugin-api, but this dependency is not included (even transitively) in the sonar-maven-plugin. All it references sonar-wise is org.sonarsource.sonar-runner:sonar-runner-api.
They seem to have changed the location and name of the version txt file but not updated all code. You might get away with manually adding an sq-version.txt with content 5.2 (no newline) to the plugin classpath (possibly by updating the plugin jar), or add a dependency on sonar-plugin-api, but these are hacks.
The sonar-maven-plugin 2.6 uses sonar-runner 2.4, which is very different from 2.5 that sonar-maven-plugin 2.7 uses (the groupId for sonar-runner has changed domains from org.codehaus.sonar.runner to org.sonarsource.sonar-runner), so it's best to stick to the v2.6 plugin until they have smoothed out the transition and released a few more versions.
The way SonarQube server version is passed to maven-sonar-plugin has changed in v2.7, along with other things, since it uses now sonar-runner 2.5.
There is indeed a bug when using it with SonarQube instances < 4.3, for which I opened the ticket: https://jira.sonarsource.com/browse/MSONAR-131
Note that SQs < 4.5 (current LTS) are no longer actively supported and there is no guarantee that sonar-maven-plugin won't be incompatible with them in other ways due to the new interface exposed by sonar-runner 2.5.
For these cases, it is probably best to lock the maven plugin version to 2.6, as already suggested.
We had the same problem at work today, we automatically use the latest version for maven and sonar plugins. It wasn't easy to find the problem at first.
The answer elcodedocle has given is correct, but i would like to add for those that use maven with sonar in an automated fashion that this is a solution aswell:
org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
This way it runs on the older version 2.6 and i can confirm that it works.
There is probably a bug in 2.7 and i hope it gets fixed soon. This was our error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven plugin:2.7:sonar (default-cli) on project (projectName): Unable to determine structure of project. Probably you use Maven Advanced Reactor Options with a broken tree of modules. "(projectName)" is orphan -> [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
EDIT:
Take a look at this post for some more information: Jenkins Sonar plugin suddenly stops working
Here is explained that the new version, 2.7, of the plugin is no longer compatible with java 6 projects. You can also find an explanation about how to fix it in Jenkins if you are not familiar with it. (my explanation was a bit short)
This is a hint:
[INFO] SonarQube version: null
Later in the code, Maven tries to parse this version number and fails. The source code is here: https://github.com/mojohaus/sonar-maven-plugin/blob/master/src/main/java/org/codehaus/mojo/sonar/bootstrap/RunnerBootstrapper.java
From the source of the SonarQube runner, this is backed by a properties instance. So maybe the code couldn't access the server or the server isn't sending this data back. Hard to tell.
What I can see is that the code changed in 2.5. That's probably why 2.4 still works. See here how to nail down the versions: Jenkins Sonar plugin suddenly stops working
Discover the appropriate plugin version for you running sonar installation.
E.g.
mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
This plugin version will not work against the latest sonar release but will work fine against a 4.1.2.

Creating a library .jar from Github in Netbeans

I am trying to use a library that is available on GitHub (MailChimp API Wrapper for Java). Unfortunately, they do not distribute the library classpath .jar or javadocs as a direct download.
Attempting to build the classpath .jar myself, I downloaded the .zip file which contained a Netbeans project and opened the Netbeans project (which is a Maven project... I'm not too familiar with Maven). I tried to clean & build the project (hoping for it to spit out a nice .jar which I can import into my other project).
But, the clean & build failed with this message:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test (default-test) on project ecwid-mailchimp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
The website it directs you to says:
This error is reported in case the execution of a plugin failed due to some unforeseen event. For example, uncatched runtime exceptions caused by the plugin will raise this error. You should report this problem to the maintainer of the plugin.
Now, I'd love to believe I've done everything correctly and that this is, indeed, a problem with the build. But, before I go sending a nastygram email to the API creator, I'd like to ensure that the error is not on my end.
So, the question is thus: If you had a Netbeans Maven project that you wanted to compile to create a library classpath .jar to use in another project, what would you do? And am I doing it correctly?
EDIT:
Building the project with -e yielded this as a result:
Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test (default-test) on project ecwid-mailchimp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ? -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test (default-test) on project ecwid-mailchimp: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.2:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:110)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: java.lang.RuntimeException: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.close(ForkClient.java:245)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:282)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:116)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:695)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAllProviders(AbstractSurefireMojo.java:666)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:624)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:587)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Soo.... that's a thing.
If you just want jar and don't want to care about test execution (where it dies) you can invoke
mvn clean install -DskipTests
to skip surefire plugin's execution and to get the jar
and then in your project add this artifact as dependency (assuming it is maven project)
<dependency>
<groupId></groupId>
<artifactId></artifactId>
<version></version>
</dependency>
if you want to see what is going wrong, I doubt it is the jvm crashed most likely related to OutOfMemory, I would increase maven's memory by setting higher heap space in MAVEN_OPTS and increasing surefire's plugin jvm's heap if it is a fork

Error while running through command line in springs

I have a test class that uses #Autowired annotation and #ContextConfiguration and #Category annotations.
The test tuns fine when its run through eclipse.
But when i try running it through Command line, it is throwing the following error.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.690s
[INFO] Finished at: Wed Jun 12 09:56:48 GMT+05:30 2013
[INFO] Final Memory: 31M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.14.1:integration-test (default) on project OmnitureSeleniumTests: Execution default of goal org.apache.maven.plugins:maven-failsafe-plugin:2.14.1:integration-test failed: There was an error in the forked process
[ERROR] java.lang.NoSuchMethodError: org.junit.runner.Request.classes(Lorg/junit/runner/Computer;[Ljava/lang/Class;)Lorg/junit/runner/Request;
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createReqestAndRun(JUnitCoreWrapper.java:128)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:111)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:84)
[ERROR] at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:138)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:597)
[ERROR] at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)
[ERROR] at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:159)
[ERROR] at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:87)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)
[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/PluginExecutionException
I am using junit 4.8.2 and
maven-failsafe-plugin:2.14.1
There could be many configuration / environmental differences when running maven from Eclipse vs command line:
The maven version / path. In Eclipse the actual maven binary can be default / explicitly set via preferences, whereas in command line your OS will pick the first one available on your PATH env var. Check maven version using mvn -version
Maven user / global settings.xml. When running through command line typically ~/.m2/settings.xml is used but this can be explicitly overridden on Eclipse preferences
Maven local repository cache. If you have discrepancy on 1 and/or 2, you could end up with different local repository cache. Incorrect artifact distribution could cause build to fail if performed against different local repository cache.
Eclipse maven could use different version of JVM than your command line.
i have changed the version of maven-failsafe-plugin to 2.6 and it is running fine thru command line now :)

Resources