Graham Pople created MSHADE-345:
-----------------------------------
Summary: Package relocation appears not to work with Scala
Key: MSHADE-345
URL: https://issues.apache.org/jira/browse/MSHADE-345
Project: Maven Shade Plugin
Issue Type: Bug
Reporter: Graham Pople
Attachments: image (4).png
(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:
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.couchbase.client</groupId>
<artifactId>scala-deps</artifactId>
<version>1.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Couchbase Scala Dependencies</name>
<description>Shadowing dependencies for Scala prokect</description>
<dependencies>
<dependency>
<groupId>com.github.plokhotnyuk.jsoniter-scala</groupId>
<artifactId>jsoniter-scala-core_2.12</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.github.plokhotnyuk.jsoniter-scala</groupId>
<artifactId>jsoniter-scala-macros_2.12</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<relocations>
<relocation>
<pattern>com.github.plokhotnyuk</pattern>
<shadedPattern>com.couchbase.client.scala.deps.plokhotnyuk</shadedPattern>
</relocation>
</relocations>
<createSourcesJar>true</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> {code}
>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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)