apache / apache/maven-shade-plugin
[MSHADE-286] Shading fails when a dependency's main artifact does not exist
- Dominant language
- Java
- Stars
- 188
- Forks
- 103
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 4
Description
**[Peter De Maeyer](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=peterdm)** opened **[MSHADE-286](https://issues.apache.org/jira/browse/MSHADE-286?redirect=false)** and commented
Shading fails when a dependency's main artifact does not exist, see the methods `ShadeMojo.invalidMainArtifact/createErrorOutput` and their caller.
A similar existence check (luckily) does not exist for the other artifacts: test jar, sources, and test sources.
This was done intentionally, but it's overly strict because it prohibits a legitimate use case: some projects don't produce a main artifact, but only e.g. a test artifact.
Such projects can't be shaded because of this existence check.
It would be better to:
- Get rid of this check, or at least relax it, such that shading also works for projects that don't produce a main artifact.
- Complete the symmetry between jar, test jar, sources and test sources by adding a `shadeJar` boolean with default value `true`, which disables shading of main artifacts in a similar way `shadeTestJar`, `createSourcesJar` and `createTestSourcesJar` work. This will allow shading to disable creation of a main artifact altogether, even when the dependencies _do_ have a main artifact.
---
**Affects:** 3.1.0
**Issue Links:**
- [MSHADE-284](https://issues.apache.org/jira/browse/MSHADE-284) Shaded test JARs are always empty
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in ShadeMojo at invalidMainArtifact and createErrorOutput, then inspect their caller and the existing shadeTestJar, createSourcesJar, and createTestSourcesJar handling. Determine whether the main-artifact check should be removed or controlled by a shadeJar option; done means dependencies without a main artifact can be shaded without this failure and main-artifact shading can be disabled consistently.
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
- Mostly clear
- Newbie friendliness
- 35/100