Skip to content

Relocations don't work on input MR jars #525

@jeffalder

Description

@jeffalder

Shadow Version

5.1.0

Gradle Version

5.6.3

Expected Behavior

If I have

relocate("foo", "shadowed.foo")

and

META-INF/versions/9/foo/Bar.class

Then I expect to see this in the output jar:

META-INF/versions/9/shadowed/foo/Bar.class

Actual Behavior

The output file is unmapped.

META-INF/versions/9/foo/Bar.class

Gradle Build Script(s)

Repro: https://github.com/jeffalder/shadow-mrjar

The dependency is a multi-release jar.

shadowJar {
    relocate("sample", "shadowed.sample")
    manifest {
        attributes(
            "Multi-Release": true
        )
    }
}

dependencies {
    compile(fileTree("creating-sample-jar/mr.jar"))
}

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

drwxr-xr-x  2.0 unx        0 b- defN 19-Oct-31 17:30 META-INF/
-rw-r--r--  2.0 unx       46 b- defN 19-Oct-31 17:30 META-INF/MANIFEST.MF
drwxr-xr-x  2.0 unx        0 b- defN 19-Oct-31 17:30 other/
-rw----     2.0 fat      513 b- defN 19-Oct-31 17:30 other/Main.class
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 shadowed/
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 shadowed/sample/
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 shadowed/sample/original/
-rw----     2.0 fat      466 b- defN 19-Oct-31 16:43 shadowed/sample/original/Java9Class.class
-rw----     2.0 fat      126 b- defN 19-Oct-31 16:31 shadowed/sample/original/Java7Class.java
-rw----     2.0 fat      430 b- defN 19-Oct-31 16:43 shadowed/sample/original/Java7Class.class
-rw----     2.0 fat      161 b- defN 19-Oct-31 16:38 shadowed/sample/original/Java9Class.java
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 META-INF/versions/
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 META-INF/versions/9/
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 META-INF/versions/9/sample/
-rw----     2.0 fat        0 b- defN 19-Oct-31 17:30 META-INF/versions/9/sample/original/
-rw----     2.0 fat      492 b- defN 19-Oct-31 16:43 META-INF/versions/9/sample/original/Java9Class.class
-rw----     2.0 fat      167 b- defN 19-Oct-31 16:32 META-INF/versions/9/sample/original/Java9Class.java

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions