zoukankan      html  css  js  c++  java
  • “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.

    方法三:

    set MAVEN_OPTS=-Xmx512m -Xms128m -Xss2m

  • 相关阅读:
    说文解字 —— 拆字
    4K 对齐与固态硬盘检测工具
    硬盘分区(主分区、扩展分区、逻辑分区)
    python+caffe训练自己的图片数据流程
    亲和数(220/284)
    浅谈多进程多线程的选择
    Linux下的多线程编程
    LINUX-进程的概念
    Linux终端那件事儿
    Linux的终端类型
  • 原文地址:https://www.cnblogs.com/hyl8218/p/5602700.html
Copyright © 2011-2022 走看看