7

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?

Matthew
  • 1,905
  • 3
  • 19
  • 26
  • Could you provide a full example? An [MCVE](https://stackoverflow.com/help/mcve) is generally the easiest way to explain your entire scenario. Also, environment variables come from the environment and can be used by different applications. The easiest way to set an environment variable on Linux is to run in your terminal `export GRADLE_OPT="-Xmx2G`, and then will be available from applications launched during that terminal session. Environment variables are basically just key/value pairs that can be shared by multiple applications. – mkobit Nov 21 '16 at 04:16

1 Answers1

3

-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

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

and_dev
  • 3,723
  • 1
  • 20
  • 28
  • As I've mentioned in the question, I've tried that, but it didn't work. So `GRADLE_OPTS` cannot be set with the `-Xmx2G` value? – Matthew Nov 19 '16 at 08:33
  • @MatthewCain You haven't actually mentioned that you tried that. You have mentioned only that you have no answer. – Roman Nov 19 '16 at 11:30
  • @and_dev I did mention it: "I've tried the first solution from this [issue](https://github.com/MinecraftForge/ForgeGradle/issues/324), but it didn't work". The first solution in that link is the one you proposed. The second one is to setup the environment variable. – Matthew Nov 20 '16 at 00:06
  • There are 2 options: either you try if with a small "g" : "-Xmx2g" which could be an issue, otherwise there might be something with your system so it does not support such an amount of memory used here, maybe you can try with 1900 megs or so – and_dev Nov 21 '16 at 11:03