#How do I pass JVM args into gradle IntelliJ

1 messages · Page 1 of 1 (latest)

jade spade
#

Hello I am trying to pass in some args into my gradle. I tried putting my args into my gradle.properties file as well as my runtime configuration and its still not working could someone help me out with this

bold canopyBOT
#

<@&987246554085740594> please have a look, thanks.

jade spade
#

org.gradle.jvmargs=-Xmx3G -Ddevauth.enabled=true -Ddevauth.configDir=/Users/name/.devauth -Ddevauth.account=main

#

heres mygradle.properties file

gritty yacht
#

you mean jvm arguments like -Xmx etc right? or do you mean arguments for public static void main(String[] args)?

jade spade
#

-Xmx i believe

gritty yacht
#

I think you can just change the applicationDefaultJvmArgs in the build.gradle

jade spade
#

from the documentation they tell me this

#

DevAuth is configured through JVM properties and a configuration file. JVM Properties can be by adding -D<propertyName>=<value> to your JVM arguments or by using System.setProperty before DevAuth is initialized (fabric preLaunch entrypoint for example).

gritty yacht
jade spade
#

Ill give those a try real quick

gritty yacht
#

and remove them from the properties file

jade spade
#

sorry if this is a stupid question

#

but shoudl I put that in my buildscript

gritty yacht
#

wdym buildscript? it should be in build.gradle

jade spade
#

uh oh

#
mod-main'.
> Could not set unknown property 'applicationDefaultJvmArgs' for object of type org.gradle.api.internal.initialization.DefaultScriptHandler.```
gritty yacht
#

share your build.gradle

jade spade
#
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "https://files.minecraftforge.net/maven"
        }
    }
    dependencies {
        classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
        classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
    }

    applicationDefaultJvmArgs = ['-Ddevauth.enabled=true']
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.github.johnrengelman.shadow'

/*
// for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot
plugins {
    id "net.minecraftforge.gradle.forge" version "2.0.2"
}
*/
version = "1.0"
group= "dev.px.hud" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

minecraft {
    version = "1.8.9-11.15.1.2318-1.8.9"
    runDir = "run"
    mappings = "stable_20"
    // makeObfSourceJar = false
}

repositories {

    maven {
        name = "jitpack.io"
        url = "https://jitpack.io"
    }

    maven {
        url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1"
    }

    mavenCentral()
    jcenter()
}

dependencies {

  //  implementation ('se.michaelthelin.spotify:spotify-web-api-java:7.3.0') {



    // for dev env
    //runtimeOnly ("me.djtheredstoner:DevAuth-forge-legacy:1.2.0")

}

reobf {
    shadowJar {
        mappingType = 'SEARGE'
        classpath = sourceSets.main.compileClasspath
    }
}```
bold canopyBOT
# jade spade ```buildscript { repositories { jcenter() maven { ...

Detected code, here are some useful tools:

Formatted code
buildscript {
  repositories {
    jcenter() maven {
      name = "forge"url = "https://files.minecraftforge.net/maven"}
  }
  dependencies {
    classpath'org.spongepowered : mixingradle : 0.6 - SNAPSHOT'classpath'com.github.jengelman.gradle.plugins : shadow : 1.2.3'classpath'net.minecraftforge.gradle : ForgeGradle : 2.1 - SNAPSHOT'}
  applicationDefaultJvmArgs = [' - Ddevauth.enabled = true'] }
apply plugin : 'net.minecraftforge.gradle.forge'apply plugin : 'com.github.johnrengelman.shadow'/*
 // for people who want stable - not yet functional for MC 1.8.8 - we require the forgegradle 2.1 snapshot
 plugins {
 id "net.minecraftforge.gradle.forge" version "2.0.2"
 }
 */
version = "1.0"group = "dev.px.hud"// http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 minecraft {
  version = "1.8.9-11.15.1.2318-1.8.9"runDir = "run"mappings = "stable_20"// makeObfSourceJar = false
}
repositories {
  maven {
    name = "jitpack.io"url = "https://jitpack.io"}
  maven {
    url = "https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1"}
  mavenCentral() jcenter() }
dependencies {
  //  implementation ('se.michaelthelin.spotify:spotify-web-api-java:7.3.0') {
  // for dev env
  //runtimeOnly ("me.djtheredstoner:DevAuth-forge-legacy:1.2.0")
}
reobf {
  shadowJar {
    mappingType = 'SEARGE'classpath = sourceSets.main.compileClasspath}
}
gritty yacht
#

ah well I think applicationDefaultJvmArgs is only for application plugins

jade spade
#

ah I see

gritty yacht
#

also that line shouldnt be in buildscript

jade spade
#

I realized that yeah

gritty yacht
#

try putting it outside

jade spade
#

same deal

#
> Could not set unknown property 'applicationDefaultJvmArgs' for root project 'mod-main' of type org.gradle.api.Project.```
#

do you think there is a way I can get it to work with the gradle.properties file

gritty yacht
#

what happens if you put that

#

ah nvm

#

these are for the build vm

#

so try in gradle.properties:

JAVA_OPTS="-Xmx3G -Ddevauth.enabled=true -Ddevauth.configDir=/Users/name/.devauth -Ddevauth.account=main"
jade spade
#

java opt it then?

#

okok

gritty yacht
#

there is also this in context of minecraft forge, though its a bit older

jade spade
#

im on an older version of forge so that might owrk

#

there is another option of putting the jar folder in my mods instead of compiling at runtime im going to try that too

#

Im on an older version of gradle (4.1) do you think it could be that

gritty yacht
#

uh not sure but why using old stuff in the first place peepoW

jade spade
#

just downloaded the mdk like that and didnt bother to change it

#

also it breaks on my pc sometimes with the newer gradle and old forge

gritty yacht
#

well I mean old forge, its not really supported

jade spade
#

fair

#

ok I think I got it to work?

#
    at me.djtheredstoner.devauth.common.auth.MojangAuthProvider.login(MojangAuthProvider.java:24) ~[MojangAuthProvider.class:?]
    at me.djtheredstoner.devauth.common.DevAuth.login(DevAuth.java:62) ~[DevAuth.class:?]
    at me.djtheredstoner.devauth.common.DevAuth.processArguments(DevAuth.java:35) ~[DevAuth.class:?]
    at me.djtheredstoner.devauth.forge.legacy.ForgeLegacyBootstrap.processArguments(ForgeLegacyBootstrap.java:10) ~[ForgeLegacyBootstrap.class:?]
    at net.minecraft.client.main.Main.main(Main.java) ~[Main.class:?]
    ... 12 more```
bold canopyBOT
jade spade
#

im going to take this as a good sign lol

gritty yacht
#

just try to print System.getProperty to see if they exist at runtime

jade spade
#

I think it works

#

thank you!

gritty yacht