apache / apache/maven-shade-plugin

[MSHADE-295] Shade plugin fails to handle "exploded" jars

Open
#295 0 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
188
Forks
103
Avg merge
16h 39m
Merged PRs (30d)
4

Description

**[Johno Crawford](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=johno)** opened **[MSHADE-295](https://issues.apache.org/jira/browse/MSHADE-295?redirect=false)** and commented

When building the Atomix project on GitLab CI [1] and Travis we are running into the same problem as described here https://issues.apache.org/jira/browse/MSHADE-215 although I am opening this issue because when downgrading Apache Maven 3.5.4 to Apache Maven 3.5.0 the Shade plugin works as expected.

Essentially the artifacts passed into the shade plugin point to the modules classes directory which fails [2] as the plugin expects jars.

Should the shade plugin be updated to support "exploded" jars? Can we ignore directories [3]? Should Maven be returning files pointing to directories in the first place?

[1]
https://github.com/atomix/atomix/pull/721
Apache Maven 3.5.4
Java version: 1.8.0_171
OS name: "linux", version: "4.14.48-coreos-r2", arch: "amd64"

[2]

Caused by: java.io.FileNotFoundException:
/builds/atomix-io/atomix/core/target/classes (Is a directory)
at java.util.zip.ZipFile.open (Native Method)
at java.util.zip.ZipFile.\ (ZipFile.java:225)
at java.util.zip.ZipFile.\ (ZipFile.java:155)
at java.util.jar.JarFile.\ (JarFile.java:166)
at java.util.jar.JarFile.\ (JarFile.java:130)
at org.apache.maven.plugins.shade.DefaultShader.newJarFile
(DefaultShader.java:371)
at
org.apache.maven.plugins.shade.DefaultShader.goThroughAllJarEntriesForManifestTransformer
(DefaultShader.java:281)
at org.apache.maven.plugins.shade.DefaultShader.shade
(DefaultShader.java:100)
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute
(ShadeMojo.java:442)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
(DefaultBuildPluginManager.java:134)

[3]
https://github.com/johnou/maven-shade-plugin/commit/e9fb7f07b38710ebbd71c7993e04ff4fad4aa613

Cheers,

Johno

---

**Affects:** 3.1.1

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the Atomix build with Maven 3.5.4 and inspect the stack trace path through org.apache.maven.plugins.shade.DefaultShader, especially newJarFile and goThroughAllJarEntriesForManifestTransformer. Compare the behavior with Maven 3.5.0 and the linked commit, then determine the expected handling for artifacts pointing to target/classes. Done means the Shade plugin no longer fails on the reported exploded-artifact case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.