0

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?

uncle Lem
  • 4,954
  • 8
  • 33
  • 53
  • I don't see `argLine` setting for aspectj maven plugin. Guess you have to set up `MAVEN_OPTS` environment var to resolve this issue. – Andrew Logvinov Dec 24 '13 at 16:59
  • @AndrewLogvinov tried to execute `export MAVEN_OPTS="-Xmx1024m"` before running rebuild script, but it doesn't help – uncle Lem Dec 24 '13 at 17:17

2 Answers2

2

export MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m"

into the build script solved the problem. (I tried to use 1024m)

uncle Lem
  • 4,954
  • 8
  • 33
  • 53
0

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)

Jorge_B
  • 9,712
  • 2
  • 17
  • 22
  • Where I can find this local installation directory? I don't remember installing aspectJ, I can find it only in my .m2 repo as jars – uncle Lem Dec 24 '13 at 17:18