-
-
Notifications
You must be signed in to change notification settings - Fork 18
Run Configurations
To run Minecraft within the development environment, VanillaGradle has a concept of a 'run configuration', which is exposed as a Gradle run task and run configurations in any applicable IDEs.
These run configurations are not bound to any specific configuration or classpath, but for standard client and server environments, customizable presets can prepare the applicable environments.
Run configurations are a project-level concept, meaning they may vary from project to project.
minecraft {
runs {
// Default run configurations for a server
server()
client()
// Run based off of `client` with a custom name and extra configuration
client("devClient") {
// Generally useful
displayName() // a custom display name, only used for IDE tasks
classpath() // customize the classpath, only supported in Gradle
ideaRunSourceSet(set) // indicate which source set IntelliJ IDEA should use for a runtime classpath (the most granular configuration supported by IntelliJ)
args("--launchTarget", "my_client_dev") // extra application arguments
allArgumentProviders // a list of providers for application arguments, called at execution time
jvmArgs("-Dlog4j2.configurationFile=log4j_dev.xml") // additional arguments for the JVM
allJvmArgumentProviders // a list of providers for JVM arguments, called at execution time
workingDirectory() // the working directory for runs, by default ${projectDir}/run
mainClass() // the main class to execute, taken from the launcher manifest by default
// More niche, most likely only useful for those stepping outside the bounds of normal client and server-based configurations
parameterTokens() // tokens to replace within a Mojang launcher manifest
requiresAssetsAndNatives.set(true) // whether this configuration should depend on asset downloading
targetVersion(8) // the Java version to run with, drawn from the launcher manifest by default
mainModule() // the main module, if running in a modular environment
}
}
}
Gradle, Eclipse, and IntelliJ all have slightly different abilities in modeling a run configuration. VanillaGradle tries to preserve as much information in each of these, but some information is lost in every non-Gradle variant of a run configuration.
In the case of both IDEs, the IDE run configurations will be overwritten on every project reimport.
- The
targetVersion
parameter is ignored, as IntelliJ does not expose JVM setting to us - The
classpath
parameter is ignored, in favor of the module associated with the providedideaRunSourceSet
- The
targetVersion
is mapped to Eclipse execution environments, which are a looser compatibility declaration, and which will not automatically download a JVM. - The
classpath
parameter is ignored, in favor of the Eclipse project classpath.