java Maven 堆空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13598949/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 13:21:57  来源:igfitidea点击:

Maven heap space

javamaven

提问by user1858798

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

当我mvn clean install在 linux RHEL 6 上运行我的构建时。我收到以下错误:java.lang.outOfMemoryError heap space.

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.

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

Where can I set the export MAVEN_OPTS command?

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

回答by Perception

You can run the mvncommand, so its irrelevant wether you are using a .shor .batfile. 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:

您可以运行该mvn命令,因此与您是否使用.sh.bat文件无关。为了将来参考,您应该记住,尽管 .bat 文件适用于 Windows,而不是 Linux。无论如何,在您运行 mvn 命令的同一个 shell 中,请先执行以下操作:

export MAVEN_OPTS="-Xmx512M"

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

然后执行你的mvn命令。如果您仍然内存不足,请增加数字。

回答by Stephen C

When I am running mvn clean install for my build on linux RHEL 6 it is showing java.lang.outOfMemoryError heap space.

当我在 linux RHEL 6 上为我的构建运行 mvn clean install 时,它显示 java.lang.outOfMemoryError 堆空间。

You need to set the MAVEN_OPTS environment variable.

您需要设置 MAVEN_OPTS 环境变量。

I have read all the articles on internet

我已经阅读了互联网上的所有文章

That is false. At best you have read a TINY FRACTION of the relevant articles.

那是假的。充其量你已经阅读了相关文章的一小部分。

... and in my machine I don't have mvn.sh, I have mvn.bat

...在我的机器中我没有 mvn.sh,我有 mvn.bat

If you have used "yum" to install Maven, then there will be a "mvn" command on your command path. On my system, it is a shell script. If you were going to "hack" a script, that would what you would edit.

如果您使用“yum”安装 Maven,那么您的命令路径上将有一个“mvn”命令。在我的系统上,它是一个 shell 脚本。如果您要“破解”一个脚本,那么您将要编辑的就是它。

But you shouldn't need to.

但你不应该需要。

and where to set export MAVEN_OPTS COMMAND.

以及在哪里设置 export MAVEN_OPTS COMMAND。

This is a very basic "How to use a Linux command shell" question.

这是一个非常基本的“如何使用 Linux 命令外壳”问题。

The answer is either you type is at the command prompt before you run the "mvn" command, or you add it to your shell initialization file and restart the shell as appropriate.

答案是要么在运行“mvn”命令之前在命令提示符下键入 is,要么将其添加到 shell 初始化文件中并根据需要重新启动 shell。



My advice would be to invest some time in reading a tutorial about how to use the Linux command shell. It will save you a lot of time in the long term.

我的建议是花一些时间阅读有关如何使用 Linux 命令外壳的教程。从长远来看,它将为您节省大量时间。