“Invalid maximum heap size” when running Maven
2016-06-21 10:11
1301 查看
运行mvn package,报错:
解决方法一:
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
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: -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
相关文章推荐
- android-R.drawable
- containsKey() 用法
- 网站登录 - 密码如何加密
- JHTP练习题及课题_第四章_控制语句Part 1-赋值、++、--运算符
- GCC 显示程序详细编译-链接过程
- CentOS下pdf阅读器
- js同步和异步编程
- Java进阶学习第24天——动态代理与类加载器
- struts2的标签在JS中的使用 中文乱码
- JSON.parse()在火狐中的bug
- 关于产品或服务的一些思考
- 横向滚动条的css样式
- IOS的后台任务
- 装饰模式
- 合并两个有序的链表(非交叉)
- SpriteKit物理引擎碰撞中5个重要信息
- SpriteKit物理引擎碰撞中5个重要信息
- SpriteKit物理引擎碰撞中5个重要信息
- JSP页面的静态包含和动态包含
- 问题