apache / apache/maven-shade-plugin

[MSHADE-403] Imports are wrongly modified even for excluded artifacts

Open
#650 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

**[Jin Kwon](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=jinahya)** opened **[MSHADE-403](https://issues.apache.org/jira/browse/MSHADE-403?redirect=false)** and commented

For following dependencies,

```xml

org.mongodb
mongodb-driver-reactivestreams
${version.org.mongodb}
compile

org.mongodb
mongodb-driver-sync
${version.org.mongodb}
compile

```

I excluded them

```xml


org.mongodb:*

```

and relocate for other artifacts.

```xml

com
com.mycompany.relocated.com

com.mycompany.**

```

Those excluded artifacts are not contained in the shaded artifact as expected.
But I see wrongly modified imports in one of main classes.

```java
import com.mycompany.relocated.com.mongodb.MongoClientSettings;
import com.mycompany.relocated.com.mongodb.client.MongoClient;
import com.mycompany.relocated.com.mongodb.client.MongoClients;
```

Should I relocate for each `com.whatever` packages from non-excluded artifacts?

Or shouldn't those packages from excluded artifacts skipped?

---

**Affects:** 3.2.4

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the Maven Shade Plugin configuration with the MongoDB dependencies excluded through artifactSet and the com.mycompany.** relocation exclusion. Trace artifact exclusion and relocation processing, then verify that imports from excluded artifacts are not rewritten while other relocations still apply.

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
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.