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

module-info.class in Multi-Release folders is not excluded by default #729

Open
Marcono1234 opened this issue Nov 29, 2021 · 0 comments
Open
Milestone

Comments

@Marcono1234
Copy link
Contributor

Marcono1234 commented Nov 29, 2021

Shadow Version

7.1.0

Gradle Version

Gradle 7.3

Expected Behavior

module-info.class in Multi-Release folders should be excluded by default (see also #352).

Some libraries (such as Log4j 2) include the module-info.class in the Multi-Release JAR folder META-INF/versions/<version> to keep compatibility with < Java 9, but at the same time define a module descriptor for JREs >= Java 9.
There is no point in keeping these module descriptor classes because they are specific to a shadowed library and not relevant (or incorrect) for the resulting 'fat JAR'.

This becomes even more important once #449 has been implemented.

Actual Behavior

The shadowed JAR contains module-info.class files in the Multi-Release JAR folder META-INF/versions/<version>.

Gradle Build Script(s)

build.gradle.kts

plugins {
    java
    id("com.github.johnrengelman.shadow") version "7.1.0"
}

repositories {
    mavenCentral()
}

dependencies {
    implementation(platform("org.apache.logging.log4j:log4j-bom:2.14.1"))
    implementation("org.apache.logging.log4j:log4j-api")
    implementation("org.apache.logging.log4j:log4j-core")
}


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

Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)

  • META-INF/versions/9/module-info.class
  • ...
@Marcono1234 Marcono1234 changed the title module-info.class in Multi-Release folders is not excluded module-info.class in Multi-Release folders is not excluded by default Nov 29, 2021
@johnrengelman johnrengelman added this to the 8.1.2 milestone Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants