"Invalid Maximum heap Size" when running Maven

Source: Internet
Author: User

Run MVN package, error:

Invalid maximum heap size: -Xmx512m.Error: Could not create the Java Virtual Machine.Error: A fatal exception has occurred. Program will exit.

Workaround One:

Alter Jvm.config in. MVN directory (it was in Controller directory). Study mvn.sh that comes with Maven. You'll see maven_opts setting in the script. Try out java-version before altering. Eg: java-xmx512m-version Now what know how to go about and make the changes.

Workaround Two:

You can try to set the initial heap size and initial permgen size relatively small, but set the proper Max Heap and Pergen T via-xms128m-xmx1024m-xx:permsize=128m-xx:maxpermsize=256m

Also don ' t set PermGen to 512-it's too much for typical scenarious.

Also want to use fork option with Maven and start plugin execution in different JVMs at all.

For example

<plugin>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-compiler-plugin</artifactId>    <version>2.5.1</version>    <configuration>      <fork>true</fork>    </configuration>  </plugin>

Also, while allocating memory Also make sure and that's the much free memory available.

"Invalid Maximum heap Size" when running Maven

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.