“Invalid maximum heap size” when running Maven

运行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.

时间: 2024-10-01 13:32:15

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

tomcat---Invalid maximum heap size 问题

在处理tomcat问题时,tomcat无法启动 查看日志如下 [2018-08-17 14:47:01] [info] Invalid maximum heap size: -Xmx4096m [2018-08-17 14:47:01] [info] The specified size exceeds the maximum representable size. #指定的大小超过最大可表示的. [2018-08-17 14:47:01] [395 javajni.c] [error] Cre

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

1 #include <iostream> 2 #include <map> 3 4 using namespace std; 5 6 class A 7 { 8 public: 9 typedef std::map<int, string> myMap; 10 11 void mapInsert(int i, string s) 12 { 13 map.insert(std::make_pair(i, s)); 14 } 15 16 void deleteMap()

FAQ How do I increase the heap size available to Eclipse?

(Redirected from FAQ How do I increase the heap size available to Eclipse) Some JVMs put restrictions on the total amount of memory available on the heap. If you are getting OutOfMemoryErrors while running Eclipse, the VM can be told to let the heap

uwsgi部署到nginx出现invalid request block size: 4161 (max 4096)...skip问题

使用Flask制作一个网页平台之后,登陆使用openid登陆,然后使用uwsgi服务部署到nginx上,运行起来没有什么问题,但是偶尔在登陆的时候出现502的错误,一般登陆成功之后后面的任何操作都不会出错. 查看uwsgi的log之后,发现出现这样的一个错误: invalid request block size: 4161 (max 4096)...skip 之前一个没有去详细搜索过,也没有具体去看错误产生的原因,因为只是偶尔出现,并且有时候重试的时候是可以登陆的,所以没有太多的去关注,今天因

WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded.已超过传入消息(65536)的最大消息大小配额

转自海乐学习原文WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded.已超过传入消息(65536)的最大消息大小配额 问题1:WebService出错 Maximum message size quota for incoming messages (65536) has been exceeded. 今天下午在网上一直搜索解决方案将近2个小时,人要崩溃了,除了StackOv

Not enough memory . Please load a smaller dataset or use a larger heap size.

今天在linux中打开Weka时,打开基因数据文件的时候出现如题所示的错误,说内存不足,需要设定一个更大的内存空间,只要执行以下命令 sudo java -Xmx1024m -jar /usr/lib/R/library/RWekajars/java/weka.jar 后,问题就解决了.不过这个命令分配的虚拟内存只是临时的,以后在weka中每次打开大的数据文件时都必须通过执行这个命令才能打开了,否则还是会提示内存不足. 以上命令中 -jar后面的是-classpath的路径,要根据自己机器上的路

Android source code compile error: “Try increasing heap size with java option &#39;-Xmx&lt;size&gt;&#39;”

export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g" ./prebuilts/sdk/tools/jack-admin kill-server ./prebuilts/sdk/tools/jack-admin start-server Android source code compile error: "Try increasing heap size wi

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

开发的时候 遇到 java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 这个异常有时候会有,有时候正常 不太好捕捉 猜测 已经把数据给了list,然后让主线程去显示:接着后台继续获取数据.那也许有可能主线程还是没刷新完,后台又把新数据给过来了 所以 猜测 是刷新头部出现的问题 也就是 news.clear(); news.addAll(0, refreshNewData); newsAdapter.notifyDataSe

[HTML 5 Performance] Measuring used JS heap size in chrome

In this lesson we will see how to measure the used JS heap size in chrome. This can be used for various needs from performance debugging to production monitoring of apps. function measureMemory() { console.log(`${performance.memory.usedJSHeapSize / M