apache / apache/maven-shade-plugin
[MSHADE-451] Shade plugin not using `build.finalName` to produce artifact with classifier.
- Dominant language
- Java
- Stars
- 188
- Forks
- 103
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 4
Description
**[Garret Wilson](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=garretwilson)** opened **[MSHADE-451](https://issues.apache.org/jira/browse/MSHADE-451?redirect=false)** and commented
I'm using Maven 3.9.1 with Java 17 on Windows 10, and Maven Shade Plugin 3.4.1.
I'm using a technique which I described in MNG-7815 which allows me to easily set the base filename of the generated artifacts in `{}target/{`}.
1. In a separate parent pom ("Root POM") in the `` section I set a property `{}${project.artifactId}{`}.
2. In the `` section I set `{}${build.finalBaseName}-${project.version}{`}.
Let's suppose my project (which inherits from Root POM) has its own child project with an `{}bar{`}. Normally because of the default Maven `{}build.finalName{`}, setting, the target artifacts will be e.g.:
* `bar-1.2.3.jar`
* `bar-1.2.3-javadoc.jar`
However with the configuration I described above, I merely need to set the following property in the child project:
```xml
foo-${project.artifactId}
```
Now my artifacts are generated with these names, just like I want:
* `foo-bar-1.2.3.jar`
* `foo-bar-1.2.3-javadoc.jar`
However the Maven Shade Plugin seems to be ignoring the final `build.finalName` and just assuming that it is set to the `{}${project.artifactId}-${project.version{`}} (which is the Maven default). For example let's say I add the following to my Maven Shade Plugin `{}{`}:
```xml
true
aws-lambda
```
I would expect the classifier to be added to the `build.finalName` (which is now `{}foo-bar-1.2.3{`})—after all, the Javadoc plugin does this just fine. However I get this:
* `bar-aws-lambda-1.2.3.jar`
* `foo-bar-1.2.3.jar`
* `foo-bar-1.2.3-javadoc.jar`
`bar-aws-lambda-1.2.3.jar` should be `foo-bar-aws-lambda-1.2.3.jar` (compare with the other generated artifacts). I'm guessing the Maven Shade Plugin is making assumptions about the value of `build.finalName` instead of using the actual value of `{}build.finalName{`}.
I have not yet done further investigations or tested with the latest version of the plugin. (I think I saw that a newer version has been released.) Nevertheless I wanted to record this bug while I have all the necessary windows open, before I stop for lunch and forget how all these pieces fit together.
---
**Affects:** 3.4.1
Contributor guide
No contributing guide indexed for this repository
Research direction
No source files or tests are named. Reproduce the Maven Shade Plugin 3.4.1 configuration with a custom build.finalName and shadedClassifierName, then locate the artifact-name handling and add a regression test. Done means the shaded artifact uses the configured final name, such as foo-bar-aws-lambda-1.2.3.jar.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100