How to fix Java heap space error in Maven

So you want to build a maven project but you ‘re getting an error like this : java.lang.OutOfMemoryError: PermGen space.

What the output says is that you have to define a MAVEN_OPTS environment variable, where you can place your -Xmx and -XX:MaxPermSize memory parameters.

What are you staring at? Go for it!

  • Right click on My Computer and select Properties
  • Click Advanced System Settings on the left
  • Go to the Advanced tab, click the Environment Variables
  • Create a New user variable, under the name of to MAVEN_OPTS and set the Variable value to what the error specified or whatever you need to get it build successfully.

  • Here’s a sample configuration :


    Advertisements

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s