apache / apache/maven-shade-plugin
[MSHADE-197] Shade fails to relocate packages for all classes
- Dominant language
- Java
- Stars
- 188
- Forks
- 103
- Avg merge
- 16h 39m
- Merged PRs (30d)
- 4
Description
**[Michael McCarthy](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mmccarthy)** opened **[MSHADE-197](https://issues.apache.org/jira/browse/MSHADE-197?redirect=false)** and commented
I attempted to relocate the `org.apache.http.*` packages using the shade plugin on the AWS Java SDK. This fails to update the location for at least one class, `com.amazonaws.services.s3.model.S3ObjectInputStream`. I manually updated the source code to use the shaded location and it compiled without issue:
```
import org.shaded.http.client.HttpClient;
import org.shaded.http.client.methods.HttpRequestBase;
import org.shaded.http.conn.EofSensorInputStream;
```
Before making the above change, the error I get is:
```
[ERROR]
\dev\CSJ\aws\temp\aws-sdk-java\aws-java-sdk-s3\src\main\java\com\amazonaws\services\s3\internal\S3ObjectResponseHandler.java:[54,26]
error: no suitable constructor found for S3ObjectInputStream(InputStream,org.shaded.http.client.methods.HttpRequestBase)
```
The configuration I used in pom.xml was:
```xml
org.apache.maven.plugins
maven-shade-plugin
2.4
com.amazonaws:*
org.apache.httpcomponents:*
org.apache.http
org.shaded.http
package
shade
```
See http://mail-archives.apache.org/mod_mbox/maven-users/201506.mbox/%3C558BE1C5.2020400%40tribloom.com%3E for more details. This thread has instructions on how to reproduce as well as links to a Github project with the changes already made and the error easy to reproduce.
---
**Affects:** 2.4
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Maven Shade Plugin 2.4 configuration in the issue and the linked reproduction details, then trace how relocation handles S3ObjectInputStream and its org.apache.http references. Run the supplied AWS SDK reproduction and verify that the shaded classes compile without constructor-type mismatches.
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