When I run maven test, java.lang.OutOfMemoryError happens. I googled it for solutions and have tried to export MAVEN_OPTS=-Xmx1024m, but it did not work.
Anyone know other solutions for this problem? I am using maven 3.0
Paste the error message here when run mvn test -e
Failed tests:
warning(junit.framework.TestSuite$1)
testDefaultPigJob_1(com.snda.dw.pig.impl.DefaultPigJobLocalTest)
testDefaultPigJob_2(com.snda.dw.pig.impl.DefaultPigJobLocalTest)
Tests run: 11, Failures: 3, Errors: 0, Skipped: 0
10/11/01 13:37:18 INFO executionengine.HExecutionEngine: Connecting to hadoop fi
le system at: file:///
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 30.063s
[INFO] Finished at: Mon Nov 01 13:37:18 PDT 2010
[INFO] Final Memory: 3M/6M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
5:test (default-test) on project dw.pig: There are test failures.
[ERROR]
[ERROR] Please refer to E:\Code\Java\workspace\dw.pig\target\surefire-reports fo
r the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-surefire-plugin:2.5:test (default-test) on project
dw.pig: There are test failures.
Please refer to E:\Code\Java\workspace\dw.pig\target\surefire-reports for the in
dividual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:199)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:140)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:314)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures
.
Please refer to E:\Code\Java\workspace\dw.pig\target\surefire-reports for the in
dividual test results.
at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugi
n.java:629)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:107)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:195)
... 19 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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
When I run maven test, java.lang.OutOfMemoryError happens. I google it for solutions and have tried to export MAVEN_OPTS=-Xmx1024m, but it did not work.
Setting the Xmx options using MAVEN_OPTS does work, it does configure the JVM used to start Maven. That being said, the maven-surefire-plugin forks a new JVM by default, and your MAVEN_OPTS are thus not passed.
To configure the sizing of the JVM used by the maven-surefire-plugin, you would either have to:
change the forkMode to never (which is be a not so good idea because Maven won't be isolated from the test) ~or~
use the argLine parameter (the right way):
In the later case, something like this:
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
But I have to say that I tend to agree with Stephen here, there is very likely something wrong with one of your test and I'm not sure that giving more memory is the right solution to "solve" (hide?) your problem.
References
Maven 2 Surefire Plugin
Classloading and Forking in Maven Surefire
For those new to Maven (like me) here is the whole config that goes in the build section of your pom. Cheers.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
</plugins>
</build>
The chances are that the problem is in one of the unit tests that you've asked Maven to run.
As such, fiddling with the heap size is the wrong approach. Instead, you should be looking at the unit test that has caused the OOME, and trying to figure out if it is the fault of the unit test or the code that it is testing.
Start by looking at the stack trace. If there isn't one, run mvn ... test again with the -e option.
To temporarily work around this problem, I found the following to be the quickest way:
export JAVA_TOOL_OPTIONS="-Xmx1024m -Xms1024m"
I have solved this problem on my side by 2 ways:
Adding this configuration in pom.xml
<configuration><argLine>-Xmx1024m</argLine></configuration>
Switch to used JDK 1.7 instead of 1.6
As mentioned in the top answers, as Surefire is creating a new JVM to run your tests, you want to pass that -Xmx1024m to the new JVM instead of the JVM where you start mvn test.
Just wanted to add that you can do that in your command like
mvn test -DargLine="-Xmx1024m"
It has equivalent effect with adding the JVM option to the Surefire plugin's configuration in pom.xml:
<configuration>
<argLine>-Xmx1024m</argLine>
</configuration>
In order to resolve java.lang.OutOfMemoryError: Java heap space in Maven, try to configure below configuration in pom
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<verbose>true</verbose>
<fork>true</fork>
<argLine>-XX:MaxPermSize=500M</argLine>
</configuration>
</plugin>
Not only heap memory. also increase perm size to resolve that exception in maven use these variables in environment variable.
variable name: MAVEN_OPTS
variable value: -Xmx512m -XX:MaxPermSize=256m
Example :
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=500m"
Related
We working in small team of 4 people. We using docker to deploy our services. One of the services is a java Spring Boot project which is deployed after building docker image with maven. To make docker image of Spring Boot service we use mvn clean package dockerfile:build.
The fun part is that my colleagues have no problem building docker image of Spring Boot service. And I get maven error message:
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.6:build (default-cli) on project 'foo': Could not build image: com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.spotify.docker.client.messages.RegistryAuth: no String-argument constructor/factory method to deserialize from String value ('osxkeychain')
I tried to remove all maven repositories from .m2/repository, restart docker, and remove all images.
Later I tried to run mvn clean package dockerfile:build in to two separate commands:
mvn package, then
mvn docker:build
mvn package passed, and mvn docker:build failed with the same error as shown above.
Maven version 3.5.4,
Docker version 18.06.1-ce, build e68fc7a,
OS: macOS mojave
I even tried to restart my PC hoping that it will fix it...
Edited:
Here is the maven pom plugin dockerfile-maven-plugin
...
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<repository>${project.artifactId}</repository>
</configuration>
</plugin>
...
Edit 2:
Full error message:
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:1.3.6:build (default) on project spring-boot-service: Could not build image: com.spotify.docker.client.shaded.com.fasterxml.jackson.databind.JsonMappingException: Can not construct instance of com.spotify.docker.client.messages.RegistryAuth: no String-argument constructor/factory method to deserialize from String value ('swarm')
[ERROR] at [Source: N/A; line: -1, column: -1] (through reference chain: java.util.LinkedHashMap["stackOrchestrator"])
[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/MojoExecutionException
Edit 3:
docker-compose.yml
wrapper:
image: spring-boot-service:latest
ports:
- "8080:8080"
expose:
- "8080"
links:
- db
- another-service
Solved:
In my case it was wrong version of dockerfile-maven-plugin. I used 1.3.6, and 1.4.7 fixed the problem.
Thanks to Boris!
Update: One more thing!
Make sure when mvn finish build naming is correct, for example:
[INFO] Successfully built **spring-boot-service:0.0.1-SNAPSHOT**
And docker-compose.yml should look like this:
...
wrapper:
image: **spring-boot-service:0.0.1-SNAPSHOT**
...
Here is the dockerfile-maven-plugin config:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>${dockerfile-maven-plugin.version}</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>${project.artifactId}</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
</plugin>
NOTE: use the latest released version 1.4.7
This configures the plugin to build and push your image with a single command:
$ mvn clean deploy
If you only want to build the Docker image, run:
$ mvn clean package
Solution:
Go to docker desktop
Open settings
Go to general and put tick on Expose daemon on tcp://localhost:2375 without TLS
enter image description here
I'm running a maven build in Java 8, using compatibility target Java 6. When I try to build with Maven in Eclipse (just this project mind you, all other projects in my workspace build just fine), I get a compilation failure from maven, but maven doesn't list any actual errors except a generic MojoFailureException. When I compile through eclipse itself (using ANT or straight Java, there are no compilation errors). Also when I build on a remote machine using Jenkins and the same source code, there also are no problems using maven. It's definitely a local problem and I can't quite figure it out.
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) #
DataAdapterFB1 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 58 source files to C:\Users\user\Desktop\GitRepo\FB1DataAdapter\code\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.460 s
[INFO] Finished at: 2018-07-18T08:20:37-04:00
[INFO] Final Memory: 11M/489M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project DataAdapterFB1: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project DataAdapterFB1: Compilation 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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1165)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 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/MojoFailureException
Relevant compiler plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<executable>${JAVA_6_HOME}\bin\javac.exe</executable>
<compilerArguments>
<bootclasspath>${JAVA_6_HOME}\jre\lib\rt.jar</bootclasspath>
</compilerArguments>
<fork>true</fork>
</configuration>
</plugin>
I have the same problem with using JDK 11 to build a Maven project that targets Java 7. Try removing <fork>true</fork> (or set it to false instead), and that should fix it. (h/t to https://stackoverflow.com/a/39657410/278800)
I don't actually know what the root cause is, though. My guess is that some part of the java environment isn't being passed to the forked compile process, like e.g. JAVA_HOME. Or maybe it's because I'm using jenv to set my java version, and that doesn't work with the forked process.
I was working on a legacy project and I came across the same issue. Steve K's answer shed some light for me as well.
Here is the maven-compiler-plugin section in my project's pom.xml
I'm using IntelliJ IDEA with built in maven and JDK8 in a Windows environment.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<executable>${jdk.home}/bin/javac</executable>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
I'm able to get the compiler running by making the value of <fork>true</fork> to false.
The reasoning behind
If the flag is false, Maven will use the same JVM process that brought up its process to do the compilation, which is fine for me as I am using Java 8 to bootstrap my Maven process.
If the flag is true, maven will try to fork (create) a new JVM process to do the job, and it will use the javac compiler defined in the <executable> section to do so. In my case, there is a ${jdk.home} variable that needs to be injected before running the Maven build. Clearly someone in our team forgot to tell the new joiner regarding for this setup.
There is some performance penalty of making the <fork> flag false though, so the ideal way is to leave it true but make sure the path in <executable> is valid.
https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#fork
I'm having trouble running release:perform with Java 8 and maven 3.0.5. I get an error when the Javadoc is generated. I have added the javadoc plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
The strange thing is that it works fine when I run 'mvn javadoc:javadoc' or 'mvn javadoc:jar'. Does anyone have a fix for this?
I'm getting this error after everything is generated:
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.3:jar (attach-javadocs) on project sdm: MavenReportException: Error while generating Javadoc:
[INFO] [ERROR] C:\dir...\JavaClass.java:50: error: self-closing element not allowed
[INFO] [ERROR] * <p/>
[INFO] [ERROR] ^
[INFO] [ERROR]
[INFO] [ERROR] Command line was: "C:\Program Files\Java\jdk1.8.0_60\jre\..\bin\javadoc.exe" #options #packages
[INFO] [ERROR]
[INFO] [ERROR] Refer to the generated Javadoc files in 'C:\dir.....\' dir.
Try disabling doc linting completely for java 8:
<profile>
<id>disable-javadoc-doclint</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
</profile>
Found it here: https://issues.shibboleth.net/jira/browse/JPAR-73
Unfortunately; I cannot tell you with the provided information why "-Xdoclint:none" isn't respected by the release plugin.
But a "simple" fix might just be to remove the argument altogether and actually fix the Javadoc issues the compiler reports (such as the self-closing elements which are not allowed).
I'm trying to do a release of my OSS library, but I keep running in to a strange issue with the maven-release-plugin. This used to work fine. I've probably updated either Maven or Git but I can't seem to find the right combination to get things working again for the release.
Has anyone run into this issue, and does anyone know of a solution? I'm using the Maven Shade Plugin (which is what is creating the dependency-reduced-pom.xml files in the build.)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 09:27 min
[INFO] Finished at: 2015-11-04T08:23:07-05:00
[INFO] Final Memory: 111M/1039M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.1:prepare (default-cli) on project rewrite-parent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] fatal: pathspec 'config-prettyfaces/dependency-reduced-pom.xml' did not match any files
[ERROR] -> [Help 1]
The dependency-reduced-pom.xml, as I understand it, is a temporary file used while merging dependencies into an uber-jar, and should not be committed, so I'm confused why maven is trying to add this file at all.
Thanks for any help.
I figured it out, at least a workaround:
Using 'checkModificationExcludes" configuration option of the maven-release-plugin to exclude the dependency-reduced-pom.xml seems to work around the issue, though I'm not sure this is exactly what the property was intended for (the documentation is unclear):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<checkModificationExcludes>
<checkModificationExclude>dependency-reduced-pom.xml</checkModificationExclude>
</checkModificationExcludes>
</configuration>
</plugin>
I am trying to build project using Maven. Unfortunately I have no experience with maven so I am a bit helpless. It is most likely caused by the riak submodule. Here is the github repo with code: YCSB
My system:
Apache Maven 3.2.2 (NON-CANONICAL_2015-04-01T06:56:20_mockbuild; 2015-04-01T08:56:20+02:00)
Maven home: /usr/share/maven
Java version: 1.8.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.51-4.b16.fc21.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.1.5-100.fc21.x86_64", arch: "amd64", family: "unix"
Maven stack trace:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single (default) on project ycsb: Failed to create assembly: Artifact: com.yahoo.ycsb:riak-binding:jar:0.3.1-RC1-SNAPSHOT (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single (default) on project ycsb: Failed to create assembly: Artifact: com.yahoo.ycsb:riak-binding:jar:0.3.1-RC1-SNAPSHOT (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated.
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:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
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: Failed to create assembly: Artifact: com.yahoo.ycsb:riak-binding:jar:0.3.1-RC1-SNAPSHOT (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated.
at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:541)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.plugin.assembly.archive.ArchiveCreationException: Artifact: com.yahoo.ycsb:riak-binding:jar:0.3.1-RC1-SNAPSHOT (included by module) does not have an artifact with a file. Please ensure the package phase is run before the assembly is generated.
at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase.addModuleArtifact(ModuleSetAssemblyPhase.java:337)
at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase.addModuleBinaries(ModuleSetAssemblyPhase.java:231)
at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase$1.accept(ModuleSetAssemblyPhase.java:140)
at org.apache.maven.plugin.assembly.model.Assemblies.forEachModuleSet(Assemblies.java:40)
at org.apache.maven.plugin.assembly.archive.phase.ModuleSetAssemblyPhase.execute(ModuleSetAssemblyPhase.java:126)
at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:178)
at org.apache.maven.plugin.assembly.mojos.AbstractAssemblyMojo.execute(AbstractAssemblyMojo.java:484)
... 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/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :ycsb
I have no idea what it means so I guess you are my only hope :D
EDIT:
After adding plugin suggested by Subodh Joshi:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.5:single (default) on project binding-parent: Failed to create assembly: Error creating assembly archive jar-with-dependencies: You must set at least one file.
EDIT2:
mvn compile works fine, but mvn package fails with above error.
You have to add maven-assembly-plugin in your pom.xml file
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.test.MainClassName</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase> <!-- packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
When I trying to work with Netbeans 12.0 OpenJDK 15, I needed import some library projects (.jar) that I developed using OracleJDK 8u231 for some code testings; the result was similiar to the question:
Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (make-assembly)
on project rgbfw-as-core-db: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single
failed: An API incompatibility was encountered while executing
org.apache.maven.plugins:maven-assembly-plugin:2.6:single: java.lang.ExceptionInInitializerError: null
For me, the solution was update the version of the "maven-compiler-plugin" and "maven-assembly-plugin" on my library projects(.jar) before make new run of "Clean and build" of the Netbeans Project explorer.
Current versions:
maven-compiler-plugin(3.8.1)
maven-assembly-plugin(3.3.0)
Do you have the dependecy for it in the pom.xml?
note the error its from maven-assembly-plugin:2.5.5
go to https://mvnrepository.com/ and search for "maven-assembly-plugin"
pick the right version 2.5.5 (or better ) and copy it to your
list in your pom file
If you have a similar plugin under your in your pom file...well
delete it and voila
Go to https://mvnrepository.com/ and search for "maven-assembly-plugin"
pick the right version 2.5.5 (or better ) and copy it to your
<dependencies> list in your pom file
Delete the plugin under your <plugins> in your pom file if its the same version as the dependency