mvn idea:idea throws a NullPointerException - maven

While I am trying to execute mvn idea:idea -X in my project. I am facing a peculiar issue -
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-idea-plugin:2.2.1:idea (default-cli) on
> project test-model: Execution default-cli of goal
> org.apache.maven.plugins:maven-idea-plugin:2.2.1:idea failed.
> NullPointerException -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
> execute goal org.apache.maven.plugins:maven-idea-plugin:2.2.1:idea
> (default-cli) on project document-model: Execution default-cli of goal
> org.apache.maven.plugins:maven-idea-plugin:2.2.1:idea failed.
> 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.PluginExecutionException: Execution
> default-cli of goal
> org.apache.maven.plugins:maven-idea-plugin:2.2.1:idea failed.
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
> ... 20 more Caused by: java.lang.NullPointerException
> at org.apache.maven.repository.legacy.DefaultWagonManager.connectWagon(DefaultWagonManager.java:244)
> at org.apache.maven.repository.legacy.DefaultWagonManager.getRemoteFile(DefaultWagonManager.java:346)
> at org.apache.maven.repository.legacy.DefaultWagonManager.getArtifact(DefaultWagonManager.java:110)
> at org.apache.maven.repository.legacy.DefaultWagonManager.getArtifact(DefaultWagonManager.java:163)
> at org.apache.maven.artifact.manager.DefaultWagonManager.getArtifact(DefaultWagonManager.java:155)
> at org.apache.maven.plugin.idea.IdeaModuleMojo.resolveClassifiedArtifact(IdeaModuleMojo.java:966)
> at org.apache.maven.plugin.idea.IdeaModuleMojo.resolveClassifier(IdeaModuleMojo.java:929)
> at org.apache.maven.plugin.idea.IdeaModuleMojo.rewriteDependencies(IdeaModuleMojo.java:587)
> at org.apache.maven.plugin.idea.IdeaModuleMojo.rewriteModule(IdeaModuleMojo.java:409)
> at org.apache.maven.plugin.idea.IdeaMojo.rewriteModule(IdeaMojo.java:220)
> at org.apache.maven.plugin.idea.IdeaMojo.execute(IdeaMojo.java:200)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
> ... 21 more [ERROR] [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
The link here reads -
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.
Being not sure of the maintainer either, seeking some help here on SO.
Update 1
Following the steps mentioned by #A_Di-Matteo in the answer, I can figure out that the failure occurs at the step
mvn idea:module
for me with a similar stack trace
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-idea-plugin:2.2.1:module (default-cli)
on project core: Execution default-cli of goal
org.apache.maven.plugins:maven-idea-plugin:2.2.1:module failed.
NullPointerException
Taking this to the important point again, is there a way to fix it?

The maven-idea-plugin is retired and not maintained any longer since 2013 (actually inactive since 2008), hence any possible incompatibility with new versions of the IDE would block its usage.
If for any reason you still seek help by the idea:idea goal, getting error, you can try a different procedure:
mvn idea:clean
mvn idea:project ---> it will create the .ipr file (core project info)
mvn idea:module ---> it will create the .iml file (library info for the module)
mvn idea:workspace ---> it will create the .iws file (personal workspace info)
The last three command would actually already be executed automatically by idea:idea, but they may help you further to check at which point the error arise and hopefully further hints for troubleshooting. However, all of these files are considered legacy files by the IDE, hence once again this is not the ideal procedure.
However, again, this could be troublesome: the plugin is most probably not compatible anymore with newer versions of the IDE.
If importing directly the parent pom.xml file doesn't import the project, then:
You could import the project as a generic Java project, then convert it to Maven project
alternatively (as worst case scenario) you may create a new Maven project in the IDE and step by step (copy&paste) re-create the one which was impossible to import: something will most probably come up as the issue or it would simply work as expected.

Related

Maven Failsafe plugin cannot find class

The project where I'm working on has several modules and one of the modules is integration_test, integrations test for all the others modules. This is a weird architecture for me and I'm not sure if I'm handling this situation correctly.
We haven't continous integration, right now we are running the suite test from Eclipse but we want to run it from a continuos integration server. I have been working on update our POM to execute it from the command line. I will include a sample project below because paste here the classes I think is not enough.
I followed the Maven Failsafe plugin documentation, but when I execute mvn clean verify -P integration-test I get Cannot find class in classpath: TestApiMain
I think this is because is trying to running that class before it's compiled but I don't know how to run the integration test after all other modules are actually compiled. I also want to implement Jacoco for test coverage. Reading the following guide to implement Jacoco I think I'm close:
https://www.petrikainulainen.net/programming/maven/creating-code-coverage-reports-for-unit-and-integration-tests-with-the-jacoco-maven-plugin/
Exception when execute mvn clean verify -P integration-test:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.20.1:verify (integration-test) on project root: There are test failures.
[ERROR]
[ERROR] Please refer to /home/francisco_aguiar/repos/sample_project/target/failsafe-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] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process
[ERROR]
[ERROR] Cannot find class in classpath: TestApiMain
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:673)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:535)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:280)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832)
[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)
Sample_project: https://drive.google.com/file/d/1Ow--OYz4LzxNZvoBPtb5Ub2khXSR74w3/view?usp=sharing
You defined plugin failsafe in parent pom in build/plugins section. It means every module, including parent, in phase integration-test must call failsafe(TestApiMain.class).
It will not work, because TestApiMain is defined in last module integration_test
You should move failsafe definition to integration_test/pom.xml to section build/plugins
For anyone who reads this who has teh project configured correctly but still has a classes not found then see if the following applies.
When upgrading to 3.0.0-M5 this plugin can fail to find classes from a transitive dependency. One simple fix instead of rolling back to 3.0.0-M4 is to add classesDirectory to your plugin configuration
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
</configuration>
</plugin>
</plugins>
</pluginManagement>

Maven: Error putting Weblogic libs into local repository

I want to put Weblogic libs into local repository (Installing and Configuring Maven for Build Automation and Dependency Management) I have the Weblogic version is 12.1.2 installed in my workstation.
I run this command:
mvn -X com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=C:\Oracle\product\11.2.0\client_x86 -Doracle-maven-sync.testingOnly=false
but I got this error:
[ERROR] Failed to execute goal com.oracle.maven:oracle-maven-sync:12.2.1-2-0:push (default-cli) on project standalone-pom: Synchronization execution failed:
No resources were processed by the sync plugin -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.oracle.maven:oracle-maven-sync:12.2.1-2-0:push (default-cli)
on project standalone-pom: Synchronization execution failed
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: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:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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: Synchronization execution failed
at com.oracle.maven.sync.ODMPushMojo.execute(ODMPushMojo.java:242)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: com.oracle.maven.sync.SyncException: No resources were processed by the sync plugin
at com.oracle.maven.sync.ODMPusher.handleError(ODMPusher.java:458)
at com.oracle.maven.sync.ODMPusher.push(ODMPusher.java:117)
at com.oracle.maven.sync.ODMPushMojo.execute(ODMPushMojo.java:240)
... 22 more
[ERROR]
[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
C:\Users\carbonell>
This may be an old thread, but the answer may still help somebody
Cause:
Issue was happening due to wrong variable -Doracle-maven-sync.oracleHome
Solution:
Please change the flag to -DoracleHome:
mvn -X com.oracle.maven:oracle-maven-sync:push -DoracleHome="your Oracle home dir" -Doracle-maven-sync.testingOnly=false
Your ORACLE_HOME points to the Oracle data base driver. I think you need to point it to the Oracle Middleware (aka Weblogic) directory.
Check that you refer to weblogic's libraries from maven as a dependency in the following way:
<dependency>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-server-pom</artifactId>
<version>12.1.2-0-0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Then, you must try this, from this reference:
mvn com.oracle.maven:oracle-maven-sync:push -Doracle-maven-sync.oracleHome=%MW_HOME% -Doracle-maven-sync.testingOnly=false
If nothing works, see also this very related issue

setup a Maven Wrapper for my project with io.takari

I want to setup the Maven Wrapper (The Maven Wrapper is an easy way to ensure a user of your Maven build has everything necessary to run your Maven build) for my project.
I will use the Takari Maven Plugin with its provided wrapper goal.
I execute the following command:
mvn -N io.takari:maven:wrapper
But I got this error
[ERROR] Failed to execute goal io.takari:maven:0.4.1:wrapper (default-cli) on project standalone-pom: Error installing the maven-wrapper archive. Cannot determine the type of archive C:\Users\carbonell\.m2\repository\io\takari\maven-wrapper\0.2.1\maven-wrapper-0.2.1.tar.gz. Input is not in the .gz for
mat -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.takari:maven:0.4.1:wrapper (default-cli) on project standalone-pom: Error installing the maven-wrapper archive.
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: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:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
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: Error installing the maven-wrapper archive.
at io.takari.maven.plugins.WrapperMojo.execute(WrapperMojo.java:67)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.RuntimeException: Cannot determine the type of archive C:\Users\carbonell\.m2\repository\io\takari\maven-wrapper\0.2.1\maven-wrapper-0.2.1.tar.gz.
at io.tesla.proviso.archive.tar.TarGzArchiveSource.<init>(TarGzArchiveSource.java:29)
at io.tesla.proviso.archive.tar.TarGzArchiveHandler.getArchiveSource(TarGzArchiveHandler.java:44)
at io.tesla.proviso.archive.UnArchiver.unarchive(UnArchiver.java:54)
at io.tesla.proviso.archive.UnArchiver.unarchive(UnArchiver.java:44)
at io.takari.maven.plugins.WrapperMojo.execute(WrapperMojo.java:60)
... 22 more
Caused by: java.io.IOException: Input is not in the .gz format
at org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream.init(GzipCompressorInputStream.java:164)
at org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream.<init>(GzipCompressorInputStream.java:137)
at org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream.<init>(GzipCompressorInputStream.java:102)
at io.tesla.proviso.archive.tar.TarGzArchiveHandler.getInputStream(TarGzArchiveHandler.java:34)
at io.tesla.proviso.archive.tar.TarGzArchiveSource.<init>(TarGzArchiveSource.java:27)
... 26 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
Answering this for posterity.
I got this on my second attempt to run this goal.
The first attempt failed with "Unsupported or unrecognized SSL message" because Maven couldn't get through my company proxy. I don't know why or how it was bypassing our internal repository configured in settings.xml. This left me with an empty gzip file at the location specified in that error message.
The second attempt produced the same error you received because the gzip file was empty.
I had to cheat a little and configure Maven via MAVEN_OPTS to use the proxy in order to download all of the necessary artifacts.

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar (default-cli) Incompatible execution data for class

this is the sonar additional properties configured in jenkins coverage job:
-Dsonar.jacoco.reportPath=${WORKSPACE}/merged_unit.exec
-Dsonar.java.coveragePlugin=jacoco
-Dsonar.dynamicAnalysis=reuseReports
-Dsonar.jacoco.itReportPath=${WORKSPACE}/merged_it.exec
i am getting the error below on jenkins :
Jenkins Log: [ERROR] Failed to execute goal
org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
(default-cli) on project aaaa-parent: Incompatible execution data for
class xxxxxxxxxxxxx with id 4050af3ab5fc5456. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal
org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
(default-cli) on project xxxxx: Incompatible execution data for class
xxxxxxxxxxxxxxxxxx with id 4050af3ab5fc5456. 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: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:862) at
org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at
org.apache.maven.cli.MavenCli.main(MavenCli.java:197) 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:483) 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)
the strange thing is that, if i set the reportPath and itReportPath the same, no matter merged_unit.exec or merged_it.exec, the sonar analysis goes well
but if i set what it should be , the error comes up .
the project is a muti-modules one, so i use the xml below to merge (i only put one module first for testing)
<target name="merge_unit_exec">
<jacoco:merge destfile="/home/qatest/test-script/aaa/unittest/report/merged_unit.exec">
<fileset dir="/home/qatest/jenkins/workspace/aaaa/aaa/target" includes="*.exec" />
</jacoco:merge>
</target>
it blocks me 2days, really appreciate for your great help., thank you
Incompatible execution data for class means that execution data contains exact same class twice, but with a different number of probes.
So check that you use exact same latest JaCoCo version everywhere. Check that you don't have stale exec files to which you append data, while they were created with another version of JaCoCo. Check that you don't have non-graceful termination of JVM that might result in incomplete corrupted exec files.
Check similar questions about same exception in “IllegalStateException: Incompatible execution data for class in…” exception from Jacoco when run for an existing ear and https://github.com/jacoco/jacoco/issues/95
-Dsonar.jacoco.reportPath=${WORKSPACE}/merged_unit.exec
-Dsonar.jacoco.itReportPath=${WORKSPACE}/merged_it.exec
-Dsonar.java.coveragePlugin=jacoco
-Dsonar.dynamicAnalysis=reuseReports
i found the solution above, but who can give a reasonable answer of that

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.

Resources