Gradle - 将不允许设置maxHeapSize? [英] Gradle - won't allow maxHeapSize to be set?

查看:412
本文介绍了Gradle - 将不允许设置maxHeapSize?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

task test(type: Test, overwrite: true, dependsOn: [setupUser]) {
    maxHeapSize "3000m"
    allJvmArgs "-Xmx3000m"
}

错误:

Error:

* What went wrong:
A problem occurred evaluating root project 'myproject'.
> Could not find method allJvmArgs() for arguments [-Xmx3000m] on root project 'myproject'.

无论我尝试什么,在运行 gradle test时遇到堆问题。我使用 1.0-milestone-9

No matter what I try, I get heap issues when I run gradle test. I'm using 1.0-milestone-9

推荐答案

第二行( allJvmArgs-Xmx3000m)是不正确的语法,这解释了Gradle抱怨的原因。第一行( maxHeapSize3000m)很好,如果不起作用,我会感到惊讶。 3000m虽然可能过高,但可能会在创建JVM时导致错误。在任何情况下,查找以下调试输出( -d ):

The second line (allJvmArgs "-Xmx3000m") is incorrect syntax which explains why Gradle complains. The first line (maxHeapSize "3000m") is fine and I'd be surprised if it didn't work. "3000m" might be too high a value though and could lead to an error when creating the JVM. In any case, look for the following debug output (-d):

[DEBUG] [org.gradle.process.internal.ProcessBuilderFactory] creating process builder for Gradle Worker 1
[DEBUG] [org.gradle.process.internal.ProcessBuilderFactory] in directory /xxx
[DEBUG] [org.gradle.process.internal.ProcessBuilderFactory] with argument#0 = -Xmx300m
...
[DEBUG] [org.gradle.process.internal.DefaultExecHandle] Started Gradle Worker 1.

这篇关于Gradle - 将不允许设置maxHeapSize?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆