apache / apache/maven-shade-plugin

[MSHADE-345] Package relocation appears not to work with Scala

Open
#345 6 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

**[Graham Pople](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=programmatix)** opened **[MSHADE-345](https://issues.apache.org/jira/browse/MSHADE-345?redirect=false)** and commented

(Apologies if this is a known issue, I searched but couldn't find it.)

I have a small pom.xml that's simply pulling in two dependent libraries from Maven, and shading them:

```java

4.0.0

com.couchbase.client
scala-deps
1.1.1-SNAPSHOT
jar

Couchbase Scala Dependencies
Shadowing dependencies for Scala prokect



com.github.plokhotnyuk.jsoniter-scala
jsoniter-scala-core_2.12
1.0.0


com.github.plokhotnyuk.jsoniter-scala
jsoniter-scala-macros_2.12
1.0.0




org.apache.maven.plugins
maven-shade-plugin
3.2.1



com.github.plokhotnyuk
com.couchbase.client.scala.deps.plokhotnyuk


true
true
true



package

shade







```

From this I expect to get an uber-jar containing those dependencies, with classfiles inside com/couchbase/client/scala/deps/plokhotnyuk/jsoniter_scala/..., and with those files starting "package com.couchbase.client.scala.deps.plokhotnyuk...".

However, while the files are moved to the correct file structure, the package names aren't adjusted.  Here's a screenshot from the sources jar:

!image (4).png!

 

And my experiments with the binary jar itself seem to indicate that the same issue exists at the bytecode level in the regular jar too, e.g. the classfiles are in the right place but the package hasn't been changed.

 

---

**Attachments:**
- [image (4).png](https://issues.apache.org/jira/secure/attachment/12990997/image+%284%29.png) (_86.83 kB_)

3 votes, 6 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Use the supplied pom.xml to reproduce the shaded source and binary jars, then inspect whether relocation updates Scala package declarations and bytecode references as well as file paths. Compare the resulting classes under com/couchbase/client/scala/deps/plokhotnyuk with the expected package names; done means both jars consistently use the relocated package.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, scala
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.