apache / apache/maven-shade-plugin

[MSHADE-154] Add ability for shade to find primary artifact from attached artifacts (similar to assembly-plugin)

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

Description

**[Richard Sand](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=rsand2)** opened **[MSHADE-154](https://issues.apache.org/jira/browse/MSHADE-154?redirect=false)** and commented

When switching from assembly-plugin to shade-plugin for a given project, I discovered that the shade plugin did not have the capability of using an attached artifact as the primary artifact - only the project's main artifact was supported.

I've attached changes to add a configuration parameter "alternativeInputClassifier", which, when specified, tells the plugin to look for an artifact with the specified classifier in the project attachments, and to use that as the primary artifact. This makes shade behave similar to assembly-plugin, and allows shade to recognize attached artifacts generated by previous plugins in a maven execution.

This was a trivial change, but required modifying several other classes and methods to accept the "primary" artifact as a parameter instead of a global variable. IMHO these changes are good for the plugin as a whole, as it will allow for future flexibility and logic for determining the entrypoint for the plugin (e.g. being able to run as a standalone goal with a specific artifact as input).

---

**Affects:** 2.0

**Attachments:**
- [patch.txt](https://issues.apache.org/jira/secure/attachment/12718974/patch.txt) (_14.33 kB_)
- [patch139and154.txt](https://issues.apache.org/jira/secure/attachment/12718946/patch139and154.txt) (_16.31 kB_)

**Issue Links:**
- [MSHADE-134](https://issues.apache.org/jira/browse/MSHADE-134) Shade plugin does not seem to be aware of the classifier setting for the jar plugin
(_**"duplicates"**_)

4 votes, 7 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the attached patch files, patch.txt and patch139and154.txt, and trace the shade plugin's handling of the project's primary and attached artifacts. Done means an alternativeInputClassifier can select the matching attached artifact as the primary input, with the related artifact-handling changes working consistently.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.