运行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. EMC DATA DOMAIN 2200 filesys destroy(數據清空及重建)

    EMC 數據清空 1.數據清空 這裡會清空file system的所有東西包括tapes

  2. WPF MVVM初体验

    首先MVVM设计模式的结构, Views: 由Window/Page/UserControl等构成,通过DataBinding与ViewModels建立关联: ViewModels:由一组命令,可以绑 ...

  3. linux使用读写锁pthread_rwlock_t

    转自:http://blog.csdn.net/onlyou930/article/details/6755593 使用读写锁 配置读写锁的属性之后,即可初始化读写锁.以下函数用于初始化或销毁读写锁. ...

  4. Ubuntu下安装Nginx

    转载自:http://www.cnblogs.com/skynet/p/4146083.html 1.Nginx安装 我使用的环境是64位 Ubuntu 14.04, Nginx是Nginx 1.10 ...

  5. Unity3d 提示 "The scripts file name does not match the name of the class defined in the script!"的解决办法

    有两个原因,一个是文件的名称和类名不一致 第二个原因是有命名空间, 排除应该是可以修复的

  6. MongoDB学习(2)—Node.js与MongoDB的基本连接示例

    前提 已经安装了node.js和MongoDB,本文使用的node.js是v0.12.0,MongoDB是3.0.0. 初始化数据 启动MongoDB服务,在test数据库中插入一条实例数据: db. ...

  7. Is WPFdead

    最近看到一个bog.http://www.codeproject.com/Articles/818281/Is-WPF-dead-the-present-and-future-of-WPF 大体上讲了 ...

  8. ios录音

    #import "ViewController.h" #import <AVFoundation/AVFoundation.h> @interface ViewCont ...

  9. cocos2dx游戏开发——微信打飞机学习笔记(一)——开发准备

    一.环境的搭建 1.Windows开发准备: (1)软件下载及安装 •下载Cocos2d-x 最新版本:http://www.cocos2d-x.org/download 或者从Cocos2d-x G ...

  10. 在C#程序中实现插件架构

    阅读提示:这篇文章将讲述如何利用C#奇妙的特性,实现插件架构,用插件(plug-ins)机制建立可扩展的解决方案. 在.NET框架下的C#语言,和其他.NET语言一样提供了很多强大的特性和机制.其中一 ...