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. node使用MySQL数据库

    内容: 1.node连接数据库 2.数据库常用操作 3.数据库实例 - 用户注册.登陆 1.node连接数据库 (1)下载mysql模块 (2)使用mysql模块连接数据库 let db=mysql. ...

  2. tensorflow data's save and load

    note: if you'll load data,the data shape should be similar with saved data's shape.    -- 中式英语,天下无敌 ...

  3. 配置WDS支持使用UEFI模式启动

    使用WDS通过Legacy+MBR方式部署操作系统不难,网上文章也有很多,本文就不赘述了,主要记录一下通过UEFI+GPT方式部署. 网上文章虽然也有介绍通过UEFI+GPT方式部署,但大多数说的比较 ...

  4. delphi 泛型 c++builder 泛型

    delphi 泛型 System.Generics.Collections.pas TList<T> http://docwiki.embarcadero.com/Libraries/Be ...

  5. ios app 生命周期

    https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/The ...

  6. box2d 易错

    1.动态刚体与一个与静态刚体重叠的小的感应刚体在contactBegin时,有些时候无法侦测到 2.bodyA.GetContactList()应用非动态刚体,会找不到另一非动态刚体的接触,非动态刚体 ...

  7. Haskell语言学习笔记(37)RWS, RWST

    RWST Monad转换器 RWST Monad转换器是将 ReaderT, WriterT 以及 StateT 这三个Monad转换器的功能集于一体的产物. newtype RWST r w s m ...

  8. 吴裕雄 实战PYTHON编程(8)

    import pandas as pd df = pd.DataFrame( {"林大明":[65,92,78,83,70], "陈聪明":[90,72,76, ...

  9. pyplot绘图区域

    pyplot绘图区域 Matplotlib图像组成 matplotlib中,整个图像为一个Figure对象,与用户交互的整个窗口 Figure对象中包含一个或多个Axes(ax)子对象,每个ax子对象 ...

  10. python数据分析笔记——数据加载与整理]

    [ python数据分析笔记——数据加载与整理] https://mp.weixin.qq.com/s?__biz=MjM5MDM3Nzg0NA==&mid=2651588899&id ...