maven 打包 OutOfMemoryError

[ERROR] Java heap space -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/OutOfMemoryError

查看官方文档,内存溢出可能有以下几种情况:

  1. You are building a very big multi-module project, each module requires a certain amount of memory so with increasing number of modules the amount of required memory increases as well until the JVM finally runs out of "Java heap space".
  2. You are using some plugins that perform memory-intensive operations like analyzing the class files of all project dependencies.
  3. You are using the Maven Compiler Plugin with the option fork=false (default) and your project has a lot of source files to compile. When using the Java compiler in embedded mode, each compiled class will consume heap memory and depending on the JDK being used this memory is not subject to gargabe collection, i.e. the memory allocated for the compiled classes will not be freed. The resultant error message typically says "PermGen space".

我的工程 pom.xml 中配制有

<resources>
<resource>
<directory>src/main/resources</directory>
<!-- <filtering>true</filtering> -->
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>

filtering 配制为 true 后,会扫描资源路径下的文件,将文件中的变量解析出来,恰好 resources 文件下有一个 27M 的文件,结果就内存溢出了,解决的办法很简单,将 filtering 改为 false 就好。

官网上还给出了另一种解决方案:

# Windows
set MAVEN_OPTS=-Xmx512m -XX:MaxPermSize=128m
# Unix
export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=128m"

每天用心记录一点点。内容也许不重要,但习惯很重要!

maven 打包 OutOfMemoryError的更多相关文章

  1. 在IDEA中用Maven打包大项目时失败问题

    今天在完成公司里某项功能开发时,准备用Maven打包,后来在打包的过程中报错:OutOfMemoryError.如下图: 后来经过查找资料,发现可以配置一下Maven的参数即可解决此问题. 配置参数为 ...

  2. maven 打包含有第三方依赖的 jar 包

    maven 打包含有第三方依赖的 jar 包:mvn assembly:assembly

  3. maven打包问题

    <build> <finalName>项目名</finalName> <!-- 配置maven打包时过滤的文件 --> <resources> ...

  4. Idea开发环境中搭建Maven并且使用Maven打包部署程序

    1.配置Maven的环境变量 a.首先我们去maven官网下载Maven程序,解压到安装目录,如图所示: b.配置M2_HOME的环境变量,然后将该变量添加到Path中 备注:必须要有JAVA_HOM ...

  5. 利用Maven打包时,如何包含更多的资源文件

    首先,来看下MAVENx项目标准的目录结构: 一般情况下,我们用到的资源文件(各种xml,properites,xsd文件等)都放在src/main/resources下面,利用maven打包时,ma ...

  6. maven打包不执行测试用例

    在执行maven打包时不需要执行测试用例,使用如下2种方式实现:-DskipTests=true : 不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下 ...

  7. maven打包步骤_maven 构建项目

    maven打包 1:先在pom文件中添加下面配置  jar <build>        <plugins>            <!-- compiler插件, 设定 ...

  8. Maven打包pom里面配置exclude 排除掉环境相关的配置文件

    Maven打包pom里面配置exclude 排除掉环境相关的配置文件 有几种方式:1. 打包时,指定环境参数把环境的配置文件复制过去2. 不打包所有的环境相关的配置文件,直接由运维的人维护 可以在上传 ...

  9. maven打包异常

    maven打包异常,如图: 问题原因:服务器密码错了.

随机推荐

  1. java基础:关于java流与文件操作

    1.描述:流是字节数据或字符数据序列.Java采用输入流对象和输出流对象来支持程序对数据的输入和输出.输入流对象提供了数据从源点流向程序的管道,程序可以从输入流对象读取数据:输出流对象提供了数据从程序 ...

  2. margin-top失效

    span标签是行类元素,只能margin-left,right 解决办法: 将span标签改为块级标签

  3. 9.求背景图片左边到#box盒子左边外框侧的距离

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. saltstack安装配置及常用命令

    1.salt安装及配置详解 https://www.cnblogs.com/lgeng/p/6567424.html centos7配置: https://www.jianshu.com/p/4c91 ...

  5. 前端-HTML练习题

    本小节重点: 熟练使用div+span布局,知道div和span的语义化的意思 熟悉对div.ul.li.span.a.img.table.form.input标签有深刻的认知,初期也了解他们,知道他 ...

  6. centos7 防火墙配置

    firewall-cmd --zone=public --add-port=80/tcp --permanentfirewall-cmd --zone=public --add-port=8080/t ...

  7. js脚本代码调试小技巧

    以前写js代码调试代码查看数据是否正确的时候不知道F12(开发者工具),都是alert(xxx)或者console.log(xxx), 现在知道还可以用document.write或者try...ca ...

  8. 正则表达式(Swift)

    课题 使用正则表达式匹配字符串 使用正则表达式 "\d{3}-(\d{4})-\d{2}" 匹配字符串 "123-4567-89" 返回匹配结果:'" ...

  9. 从给定字符串中截取n个字节的字符(解决汉字截取乱码问题)

    function GetNBytesChar(s: Ansistring; n: Integer): string;var  aStr: AnsiString;  bStr: WideString;b ...

  10. 简单AOP

    代码如下 //使用说明 //1,新加接口与类 //2,新加类并实现ICallHandler类: ExecuteHandler //3,新建特性并实现HandlerAttribute和重写其中的Crea ...