Maven Failsafe plugin cannot find class - maven

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>

Related

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.

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.

Specify dependency version for Maven Archetype plugin

I am currently working with Maven 3.3.3, from which the mvn.bat file has been removed. The recommended and only way to run Maven is now through the mvn.cmd file.
I am using a custom archetype that calls the maven-invoker plugin for some operation. Note that the invoker plugin is a dependency of the Maven archetype plugin.
On archetype:generate, the invoker is called and throws an error :
Error configuring command-line. Reason: Maven executable not found at: <MAVEN_PATH>\bin\mvn.bat
This issue seems to have been fixed with the release 2.2 of the invoker, but the last version of maven-archetype-plugin still uses an old version of it.
How can I specify, in my archetype's POM, the version of the invoker plugin to use ?
For now, I've tried to configure the plugin by adding this code into the archetype's POM file, but it had no effect, and didn't fixed the error.
<plugin>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>maven-archetype</artifactId>
<version>2.4</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>
EDIT 1 :
Here's the filtered stack trace.
[INFO] Invoking post-archetype-generation goals: com.company.my-custom-maven-plugin:uuid-generator
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.777 s
[INFO] Finished at: 2016-02-08T15:09:19+01:00
[INFO] Final Memory: 18M/210M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: Cannot run additions goals. Error configuring command-line. Reason: Maven executable not found at: <MAVEN_PATH>\bin\mvn.bat -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: Cannot run additions goals.
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: Cannot run additions goals.
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.invokePostArchetypeGenerationGoals(CreateProjectFromArchetypeMojo.java:241)
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute(CreateProjectFromArchetypeMojo.java:219)
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: org.apache.maven.shared.invoker.MavenInvocationException: Error configuring command-line. Reason: Maven executable not found at: <MAVEN_PATH>\bin\mvn.bat
at org.apache.maven.shared.invoker.DefaultInvoker.execute(DefaultInvoker.java:105)
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.invokePostArchetypeGenerationGoals(CreateProjectFromArchetypeMojo.java:237)
... 23 more
Caused by: org.apache.maven.shared.invoker.CommandLineConfigurationException: Maven executable not found at: <MAVEN_PATH>\bin\mvn.bat
at org.apache.maven.shared.invoker.MavenCommandLineBuilder.findMavenExecutable(MavenCommandLineBuilder.java:597)
at org.apache.maven.shared.invoker.MavenCommandLineBuilder.build(MavenCommandLineBuilder.java:68)
at org.apache.maven.shared.invoker.DefaultInvoker.execute(DefaultInvoker.java:101)
... 24 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
This is a bug of the Maven Archetype Plugin: the JIRA issue is ARCHETYPE-488. It affects all versions of the plugin ≤ 2.4 and is resolved with version 3.0.0.
Quoting Jörg Hohwiller in the linked issue (dated 08-Jan-2016 13:47):
Is there a workaround for it?
Yep. Just create a copy of "mvn.cmd" that you call "mvn.bat" in MAVEN_HOME/bin.
So a possible work-around with 2.4 or earlier is just to make a copy of the mvn executable with the other name.
The bug references by #Tunaki has been fixed (posting for reference) and the pom.xml needs:
<plugin>
<artifactId>maven-archetype-plugin</artifactId>
<version>2.4</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</plugin>

Building hadoop using maven

I tried to build hadoop mapreduce project with maven, but it always stuck in following error,
I already perform predefined installation for yarn i.e. Protobuf installation.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler- plugin:2.3.2:compile (default-compile) on project hadoop-yarn-common: Compilation failure: Compilation failure:
[ERROR] /home/mohyt/workspace/hadoop-trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop- yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/ProtoOverHadoopRpcEngine.java:[76,2] method does not override or implement a method from a supertype
[ERROR] /home/mohyt/workspace/hadoop-trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/ProtoOverHadoopRpcEngine.java:[262,16] org.apache.hadoop.yarn.ipc.ProtoOverHadoopRpcEngine.Server is not abstract and does not override abstract method call(java.lang.String,org.apache.hadoop.io.Writable,long) in org.apache.hadoop.ipc.Server
[ERROR] /home/mohyt/workspace/hadoop-trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/ipc/ProtoOverHadoopRpcEngine.java:[319,4] method does not override or implement a method from a supertype
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project hadoop-yarn-common: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 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/MojoFailureException
[ ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :hadoop-yarn-common
I came across same problem during hadoop 2.2.0 source code building. During "mvn install -DskipTests" this error came in "Hadoop Auth" Folder.
From somewhere(i dont remember from where) i came to know that there is one missing dependency in pom.xml of this Hadoop Auth folder
dependency is
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
I added this dependency and again tried "mvn install -DskipTests". My error resolved.
Hope this will work in your case also
Apache documentation says 'JavaTM 1.6.x, preferably from Sun, must be installed.'.
Also, check the override behavior in the different versions of Java.
Looks like you have Java 5.

Resources