2

If I am building a projecting using:

mvn install

I see the following:

[ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] Failure executing javac, but could not parse the error: The system is out of resources. Consult the following stack trace for details. java.lang.OutOfMemoryError: PermGen space 

I'm not sure where I would be updating my java options?

I'm running this on ubuntu.

2

2 Answers 2

7

If you don't like to be dependent on somebody's environment you may specify to fork compiler plugin and allocate enough memory to it.

I suggest you actually do this in the <pluginManagment> section of your parent POM project

<build> ... <pluginManagment> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> ... <!-- Memory management --> <fork>true</fork> <meminitial>128m</meminitial> <maxmem>512m</maxmem> ... </configuration> </plugin> ... </pluginManagment> ... </build> 
Sign up to request clarification or add additional context in comments.

2 Comments

so this fires up a new jvm as oppose to using the one the os uses by default?
For future generations, you want to do exactly this. It makes it far easier to on board smoothly because a git clone setups the maven environment without have to touch the PC. It also keeps the configurations easily accessible when trouble shooting the build (pom is the first place to look after the stacktrace, so, technically the second place to look).
4

Tweak your maven options. Generally this is set in /etc/mavenrc, ${HOME}/.mavenrc, or your Windows environmental properties dialog box.

export MAVEN_OPTS="-Xmx512M -XX:MaxPermSize=512M" 

has worked for some, you might need to bump the numbers up (depending on your circumstance)

The first option "-Xmx512M" configures maximum memory, while the second option "-XX:MaxPermSize=512M" allows PermGen space to grow as large as (in this case) the maximum memory.

1 Comment

Down voted because, while it works, it will put any projects that follow this advice at risk when moving between PCs.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.