Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shadowJar task with minimize() doesn't use gradle toolchain. #1034

Open
VasilisManol opened this issue Nov 20, 2024 · 0 comments
Open

shadowJar task with minimize() doesn't use gradle toolchain. #1034

VasilisManol opened this issue Nov 20, 2024 · 0 comments
Labels

Comments

@VasilisManol
Copy link

Expected and Results

call shadowJar task with minimize() without errors.

Related environent and versions

Gradle 8.6
shadow 8.3.5

Installed JDKs
openjdk 8 - default
openjdk 21

Reproduction steps

  • Use jdk 8 as default
  • Install jdk 21
  • Create a gradle project with build.gradle.kts:
plugins {
    id("java")
    id("com.gradleup.shadow") version ("8.3.5")
}

java {
    toolchain {
        languageVersion.set(JavaLanguageVersion.of(21))
    }
}

configure<JavaPluginExtension> {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_21
}

repositories {
    mavenCentral()
    mavenLocal()
}

dependencies {
....
}

tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
    exclude("META-INF", "META-INF/**")
    minimize()
    archiveClassifier.set("")
    isZip64 = true
}

tasks {
    build {
        dependsOn(shadowJar)
    }
}
  • Build e.g. ./gradlew build
    Then the following error occurs:
  Execution failed for task ':shadowJar'.
> org/vafer/jdependency/Clazzpath has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

If minimize() is commented out it builds as expected.

Anything else?

This error looks related with #814 but maybe not exactly the same. When switching to jdk21 as default jdk, minimize() doesn't give any error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant