I'm trying to build project with Maven, but I'm getting this error:
[INFO] --- aspectj-maven-plugin:1.4:compile (default) # core ---
[ERROR] ABORT
[ERROR] AspectJ 1.6.1 ran out of memory during compilation:
Please increase the memory available to ajc by editing the ajc script
found in your AspectJ installation directory. The -Xmx parameter value
should be increased from 64M (default) to 128M or even 256M.
I tried configure aspectj-maven-plugin in pom.xml, but it doesn't take any effect:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<configuration>
<argLine>-Xmx1024m</argLine>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
My local copy works fine, this error happens only in deployment. How it can be fixed?
export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m"
into the build script solved the problem. (I tried to use 1024m)
I can't seem to find any memory usage options in the plugin manual. Maybe you should do as it suggests and manually change the ajc script in your local installation directory (although I must admit it seems a poor solution)
Related
I saw couple of problems like this but none of the given advice helped me, so I add this.
I have Java app and I migrate it to Java 11. I can run it but when i try to mvn install it i get tge error:
Failed to execute goal
org.codehaus.gmavenplus:gmavenplus-plugin:1.6:compileTests (default)
on project osa-backend: Execution default of goal
org.codehaus.gmavenplus:gmavenplus-plugin:1.6:compileTests failed:
Unrecognized target bytecode.
This is my plugin:
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.16</version>
</dependency>
</dependencies>
</plugin>
Thanks for any suggestions cause I have no idea what can I change now.
This message is to warn you that your desired bytecode is not supported by the versions you currently have.
Targeting Java 11 bytecode requires Groovy 2.5.3/3.0.0-alpha-4 or newer and GMavenPlus 1.6.2 or newer.
In my case bumping the version of the maven-compiler-plugin from 3.8.1 to 3.10.1 solved the issue, every other approach suggested in similar threads failed :
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
where ${maven.compiler.release} = your java version
Trying to build an example from camel via mvn package
apache-camel-2.22.0/examples/camel-example-cdi-xml
Getting an error never seen before, i checked dependency tree for transitive deps and apache-collections is 3.2.1 and not corrupt so can't explain it, obviously i know what it means, just can't figure out why it's happening because everything that should be required is provided:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (process-resource-bundles) on project camel-example-cdi-xml: Execution process-resource-bundles of goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process failed: A required class was missing while executing org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process: org/apache/commons/collections/ExtendedProperties
Not really sure how to trouble shoot it.
I tried building with several different versions of maven. JDK = 1.8
update pom.xml add the following code
<plugin>
<artifactId>maven-remote-resources-plugin</artifactId>
<version>1.6.0</version>
<dependencies>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>bundle</goal>
</goals>
</execution>
</executions>
</plugin>
I have a project that uses Netty 4.0.29 and I have another dependency that pulls in netty 3.9.0. I put in an exclusion but it is still roping in 3.9.0 when I run copy-dependencies.
<dependency>
<groupId>com.ning</groupId>
<artifactId>async-http-client</artifactId>
<version>1.9.31</version>
<exclusions>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
</exclusion>
</exclusions>
</dependency>
If I run mvn dependency:tree with this exclusion in place, I see that it is indeed excluded:
[INFO] +- com.ning:async-http-client:jar:1.9.31:compile
But when I run mvn clean dependency:copy-dependencies I see the jar 3.9.0 being copied along with the 4.0.29. According to the documentation and Google, this should not copy when there is an exclusion.
[INFO] Copying netty-3.9.0.Final.jar to /Users/udonom1/wk/141/coursecopy-api/target/dependency/netty-3.9.0.Final.jar
[INFO] Copying netty-all-4.0.29.Final.jar to /Users/udonom1/wk/141/coursecopy-api/target/dependency/netty-all-4.0.29.Final.jar
I tried excluding as suggested by the first answer below and that did not work.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<excludeArtifactIds>io.netty:netty:3.9.0.Final</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
I also added a dependency as further suggested:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>4.0.29.Final</version>
</dependency>
What am I doing wrong?
For those who are having the same issue. I used mvn -X and discovered that dependency:tree is omitting two other jars that are referencing netty. I added exclusions for those and I'm good to go. Spent a whole day on this.
If you are writing not library you have simple way to control versions of any dependency in your project - dependencyManagement block in root pom file, example:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>4.0.29.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
Additional bonuses from this block - you can omit version and scope for dependency in concrete dependency (with same group id, artifact id and packaging).
PS another look to your dependencies make me ask you: are you sure that this dependency have single maven artifact id? netty-all-4.0.29.Final.jar - seems that this artifact should have netty-all artifact id... If they have different artifact id's my recipe wouldn't help. In this case you should define build configuration for maven-dependency-plugin, example:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<configuration>
<excludeArtifactIds>io.netty:netty:3.9.0.Final</excludeArtifactIds>
</configuration>
</plugin>
</plugins>
</build>
or just use -DexcludeArtifactIds parameter in your maven call
I'm trying to use some nifty lazy logging tricks in my logging layer but AspectJ is choking on it. I have a facade in front of log4j. Here's the code:
public void debug ( Supplier<String> message )
{
if( isDebugEnabled() )
{
debug( message.get() );
}
}
The error:
[ERROR] The type java.util.function.Supplier cannot be resolved. It is indirectly referenced from required .class files
/home/Build/src/Core/Database/src/com/BasicDao.java:1006
LOGGER.debug( "Retry number: "+retryCount+"DB Lock Conflict, sleeping "+retrySleepTime );
Here's my pom bits:
<plugin>
<!-- This plugin integrates aspectj into our build cycle -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
And:
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.5</version>
</dependency>
Other interesting facts are that this compiles fine within Eclipse, but I get this error when running mvn package from a Linux command line.
Upon further trial/error we have discovered that if we manually set JAVA_HOME to point to Java 8 then it compiles. It looks like AspectJ requires your JAVA_HOME to point to the right version of Java. In the main pom we are directing maven to use the specific version of Java with:
<executable>${JAVA_1_8_HOME}/bin/javac</executable>
<jvm>${JAVA_1_8_HOME}/jre/bin/java</jvm>
Neither of those seemed to work with the aspectj-maven-plugin configuration.
i would like to know if someone already had this kind of javascript error :
In Chrome Console :
Uncaught java.lang.ClassCastException (anonymous function)
EED997003B4F236C1F5D6AE53E1170DA.cache.html:1624
Using Firefox :
CallPageHandler method :
'java.lang.ClassCastException' when calling method: [nsIDOMEventListener::handleEvent]
Considering that when i execute my project in debug mode (gwt eclipse plugin + plugin chrome browser) i have 0 error/warning. So the previous error only occurs without the use of gwt debug (project is successfuly build with maven).
I have checked my client side sources several times to find a probable error but i found nothing...
Maybe my configuration of gwt plugin in pom file is not correct (and could be an explanation of the different behaviour between debug and no-debug mode) :
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<configuration>
<webappDirectory>${basedir}/target/${project.build.finalName}</webappDirectory>
<module>[myMainClass]</module>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I'm using 2.4.0 gwt version and 2.0 maven plugin.
Thx for u help and i can give more detail if necessary !
>>> Resolved (see comments...) <<<