Maven堆空间

问题描述:

当我在Linux RHEL 6上运行 mvn clean install 时,我收到以下错误: java.lang.outOfMemoryError堆空间

When I am running mvn clean install for my build on linux RHEL 6. I'm getting the following error: java.lang.outOfMemoryError heap space.

我已经阅读了互联网上的所有文章。在我的机器上,我没有名为 mvn.sh 的文件,我只有一个文件 mvn.bat

I have read all the articles on internet. On my machine I dont have a file called mvn.sh, I only have a file mvn.bat.

我在哪里可以设置导出MAVEN_OPTS命令?

Where can I set the export MAVEN_OPTS command?

你可以运行 mvn 命令,所以你无关紧要的是使用 .sh .bat 文件。为了将来参考,您应该记住,.bat文件适用于Windows,而不适用于Linux。无论如何,在运行mvn命令的同一shell中,首先执行此操作:

You can run the mvn command, so its irrelevant wether you are using a .sh or .bat file. For future reference you should keep in mind though that .bat files are for Windows, not Linux. Anyway, in the same shell you are running your mvn command in, do this first:

export MAVEN_OPTS="-Xmx512M"

然后执行 mvn 命令。如果你的内存不足,请将数字提高。

Then execute your mvn command. Bump the number up if you still run out of memory.