Skip to content

[v4] SourceJar plugin needs to be applied after setting java toolchain version #17

Description

@Jonathing

Probably due to how a ClasspathExec task gets the java launcher convention during initialization, and that type of task is created when this plugin is applied. Not sure if it is really an issue, but I've decided to report it as such.

I've worked around it with my Plugin DSL setup by doing this:

plugins {
    // ...
    id 'org.moddingx.modgradle.sourcejar' version '[4,5)' apply false
    // ...
}

// setting version variable and other mundane stuff...

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

apply plugin: 'org.moddingx.modgradle.sourcejar'

// everything else...

If you're curious, here's my settings.gradle setup:

pluginManagement {
    resolutionStrategy {
        eachPlugin {
            // ModGradle
            var plugin = requested.id.toString()
            if (plugin.startsWith('org.moddingx.modgradle.')) {
                useModule "org.moddingx:ModGradle:${requested.version}"
            }
        }
    }
    repositories {
        gradlePluginPortal()
        maven { url = 'https://maven.minecraftforge.net/' }
        maven { url = 'https://repo.spongepowered.org/maven' }
        maven { url = 'https://maven.parchmentmc.org' }
        maven { url = 'https://maven.moddingx.org' }
    }
}

plugins {
    id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}

Gradle 8.1.1
ForgeGradle 6.0.11
ModGradle 4.0.4

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions