运行mvn package,报错:

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

解决方法一:

alter jvm.config in .mvn directory ( it is in controller directory ). study mvn.sh that comes with maven. you will see MAVEN_OPTS setting in the script. try out java -version before altering. eg : java -Xmx512m -version now you know how to go about and make the changes.

解决方法二:

you can try to set the initial heap size and initial permgen size relatively small, but set the proper max heap and pergent via -Xms128m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=256m

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

Also you may 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 that you have that much free memory available.

方法三:

set MAVEN_OPTS=-Xmx512m -Xms128m -Xss2m

“Invalid maximum heap size” when running Maven的更多相关文章

  1. soapUI启动报错:The JVM could not be started. The maximum heap size (-Xmx) might be too large or an antivirus or firewall tool could block the execution.

    版本: soapUI-5.2.1 问题: 启动soapUI时报错:The JVM could not be started. The maximum heap size (-Xmx) might be ...

  2. Invalid initial heap size: -Xms

    -Xxs512m注意 Xxs 和 512m中间无空格就行了.

  3. How To Fix soapUI JVM Maximum Heap Size (-Xmx) Error [Solution]

    http://quicksoftwaretesting.com/soapui-jvm-heap-size-xmx-error/ -Xms128m -Xmx1000m -Dsoapui.properti ...

  4. Setting Tomcat Heap Size (JVM Heap) in Eclipse

    this article picked from:http://viralpatel.net/blogs/setting-tomcat-heap-size-jvm-heap-eclipse/ Rece ...

  5. 报错解决——uwsgi错误invalid request block size

    uwsgi错误invalid request block size 使用uwsgi启动django代码,然后打开浏览器输入http://localhost:8000/admin.后台出现下面错误 in ...

  6. uwsgi错误invalid request block size

    uwsgi错误invalid request block size 今天使用uwsgi启动django代码,然后打开浏览器输入http://localhost:8000/admin.后台出现下面错误 ...

  7. for循环中删除map中的元素,valgrind检测提示error:Invalid read of size 8

    #include <iostream> #include <map> using namespace std; class A { public: typedef std::m ...

  8. heap size eclipse 堆内存

    可以根据eclipse 或 myeclipse heapstats 使用情况调整堆内存大小,heap size 设置,-vmargs-Xms256-Xmx1024 ,其中Xms表示初始值,Xmx表示最 ...

  9. listview 遇到问题java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

    开发的时候 遇到 java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 这个异常有时候会有,有时候正常 不太好捕捉 猜测 已经 ...

随机推荐

  1. hibernate中many-to-one关联时出现ObjectNotFoundException异常

    采用多对一关联,如果一的那端删除了,多的这端无法感知,虽然数据库中可以通过外键配置将多的一端置空,可是在hibernate里面我暂时不知道如何处理. 目前采用的方式: 1.首先,数据库中需要配置好外键 ...

  2. CentOS下用yum配置php+mysql+apache(LAMP)

    #安装需要的包,有依赖关系,自动帮你解决 yum install httpd mysql mysql-server php php-gd php-mbstring php-mysql #启动httpd ...

  3. [unity3d插件]2dtoolkit系列一 创建精灵

    从今天开始要做一个2d游戏,由于之前都是做cocos2dx的,然后接触了一段时间的unity3d,都是做3D方面的东西,得知要做2d游戏还是有点开心的,或许因为不想丢失之前的2d游戏的一些思想,然后接 ...

  4. 在Salesforce中向Page Layout中添加Visualforce Page

    在Salesforce中可以向Object所对应的Layout中添加我们自定义的Visualforce Page. 此时的Visualforce Page与Asp.Net MVC中的Partial V ...

  5. Codeforces Round #229 (Div. 2) C. Inna and Candy Boxes 树状数组s

    C. Inna and Candy Boxes   Inna loves sweets very much. She has n closed present boxes lines up in a ...

  6. Java学习随笔3:遍历文件夹及文件的读取和写入

    import java.io.File; /** * 遍历文件夹 */ public class ScannerFile { public static void main(String[] args ...

  7. BNUOJ1067生成函数入门

    https://www.bnuoj.com/v3/problem_show.php?pid=1067

  8. Liferay 6.2 改造系列之十一:默认关闭CDN动态资源

    在行业客户中,一般无法提供CDN服务,因此默认关闭CDN动态资源功能: 在/portal-master/portal-impl/src/portal.properties文件中,有如下配置: # # ...

  9. 实现Web验证码图片-原理

    实现验证码的基础 GDI+ graphics device interface plus的缩写,即图形设备接口.GDI+为开发者提供了一组实现与各种设备(具有图形化能力但不涉及图形细节的设备)进行交互 ...

  10. Android学习系列(42)--Android Studio实战技巧

    使用android studio开发项目的一些问题,功能和技巧. 1. 环境 Mac OSX 10.9.5 + Android Studio 0.8.9 2. gradle项目加载超慢 这是因为gra ...