Skip to content

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

@Marcono1234

Description

@Marcono1234

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
  • ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions