Monday, January 27, 2014

Troubleshooting - Maven

 @If you get an error the following error(or OutOfMemory) in Maven Compile and Test.
-----------------------------------------------------------------------------------------
Exception in thread "main" java.lang.StackOverflowError
    at sun.nio.cs.UTF_8.updatePositions(UTF_8.java:77)
    at sun.nio.cs.UTF_8$Encoder.encodeArrayLoop(UTF_8.java:564)
    at sun.nio.cs.UTF_8$Encoder.encodeLoop(UTF_8.java:619)
    at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:561)
    at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:271)
    at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125)
    at java.io.OutputStreamWriter.write(OutputStreamWriter.java:207)
    at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
    at java.io.PrintStream.write(PrintStream.java:526)
    at java.io.PrintStream.print(PrintStream.java:669)
    at java.io.PrintStream.println(PrintStream.java:806)
    at org.apache.maven.cli.PrintStreamLogger.info(PrintStreamLogger.java:111)
    at org.codehaus.plexus.logging.AbstractLogger.info(AbstractLogger.java:51)
    at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:478)
    at org.codehaus.plexus.archiver.AbstractArchiver$1.hasNext(AbstractArchiver.java:481)
-----------------------------------------------------------------------------------------
@Solution
In your mvn.sh add this as the first line after the copyright and other comments.
#----------------------------------------------------------------------------------------- 
export MAVEN_OPTS="-Xms128m -Xmx1024m -Xss128m"
#----------------------------------------------------------------------------------------- 

1 comment: