如何设置Gradle环境变量? [英] How to set Gradle environment variables?

查看:137
本文介绍了如何设置Gradle环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行Gradle命令行任务 -setupDecompWorkspace 来设置Minecraft Forge,但是该任务卡在了decompileMC上.我已经尝试过此 issue 的第一个解决方案,但是没有用.第二种解决方案建议将 GRADLE_OPTS 环境变量设置为 -Xmx2G .我不知道该怎么做.在网上搜索了几个小时后,我仍然找不到答案.即使是正式的Gradle 文档也无济于事.我是否需要在gradle.properties文件中声明变量,将其作为命令行参数或完全不同的方式输入?

I'm trying to execute a Gradle command-line task -setupDecompWorkspace to set up Minecraft Forge, but the task gets stuck on decompileMC. I've tried the first solution from this issue, but it didn't work. The second solution suggest setting the GRADLE_OPTS environment variable to -Xmx2G. I don't exactly know how to do this. After searching online for a couple of hours I am still found with no answer. Even the official Gradle documentation doesn't help. Do I need to declare the variable in the gradle.properties file, enter it as a command-line argument or something completely different?

推荐答案

-Xmx2G 是JVM命令行参数,如果要将其设置为Gradle属性,只需将其添加到 gradle.properties 文件:

-Xmx2G is a JVM command line parameter, if you want to set it as a Gradle property just add it to the gradle.properties file in your project root:

org.gradle.jvmargs=-Xmx2G

您还可以在此处找到一些更有用的信息: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

You can also find some more useful information here: https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties

这篇关于如何设置Gradle环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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