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. Python日志配置类

    # -*- coding: utf-8 -* """日志工具类 author: Jill usage: from common.logger import Log log ...

  2. SQL Server数据库定时备份解决方案

    SQL Server数据库定时备份解决方案 1.本方案采用软件为:SQLBackupAndFTP 10.0.3 版本,压缩包自带注册机,请自行破解. 2.软件截图如下: 3.功能说明:自动定时备份相关 ...

  3. 温故而知新-mysql的一些语法show,describe,explain,fulltext

    1 show show tables; 显示数据库的所有表 show databases; 显示所有数据库 show columns from table; 显示表的所有列 show grants f ...

  4. spring securiry Xml 配置 登陆

    参考:https://blog.csdn.net/yin380697242/article/details/51893397 https://blog.csdn.net/lee353086/artic ...

  5. location 对象属性

    Location 对象属性 hash 返回一个URL的锚部分 host 返回一个URL的主机名和端口 hostname 返回URL的主机名 href 返回完整的URL pathname 返回的URL路 ...

  6. AJAX服务器返回数据 连接数据库查询数据

    getcustomer.asp" 中的源代码负责对数据库进行查询,然后用 HTML 表格返回结果: <% response.expires=-1 sql="SELECT * ...

  7. IdUDPServer 收到4次重复的数据

    IdUDPServer1->Send(RemoteIP, LabeledEdit2->Text.ToInt(), InText, IndyTextEncoding_UTF8()); 我发给 ...

  8. 6 unit3-文件操作&函数 review

    文件处理相关 1.编码问题 (1)请说明python2 与python3中的默认编码是什么? py2默认ASCII码,py3默认的utf8 (2)为什么会出现中文乱码?你能列举出现乱码的情况有哪几种? ...

  9. 下载gradle缓慢的解决方法

    用AndroidStudio或者Qt编译apk,下载gradle缓慢时,可以用迅雷等下载工具在https://services.gradle.org/distributions/下载对应的版本. 中断 ...

  10. Jena TDB Assembler

    TDB Assembler Assemblers (装配器) 是Jena中用于描述将要构建的对象(通常是模型和数据集 models & datasets)的一种通用机制.例如, Fuseki ...