[Comment Edited] (MSHADE-252) shadeSourcesContent is broken when combined with partial relocation

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Comment Edited] (MSHADE-252) shadeSourcesContent is broken when combined with partial relocation

Scof (Jira)

    [ https://issues.apache.org/jira/browse/MSHADE-252?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17316937#comment-17316937 ]

Alexander Kriegisch edited comment on MSHADE-252 at 4/8/21, 7:55 AM:
---------------------------------------------------------------------

Nobody has reacted to my pull request on GitHub. [~elharo], [~hboutemy], I see you committing to that project sometimes. [~olamy], I saw that you worked on the source code shading feature before. Sorry to ask you all directly, but would you please review my PR and merge it, if possible? I think it is a considerable improvement.

Meanwhile, if anybody would like to test my fix with regard to this issue, you can use it like this:
 {code:xml}
<pluginRepositories>
  <!-- TODO: Remove after upstream release for Maven Shade with fix for MSHADE-252 -->
  <pluginRepository>
    <id>github</id>
    <name>GitHub Packages</name>
    <url>https://maven.pkg.github.com/kriegaex/aspectj-packages</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </pluginRepository>
</pluginRepositories>

<!-- (...) -->

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <!-- TODO: Replace by release in which https://issues.apache.org/jira/browse/MSHADE-252 is fixed -->
  <version>3.2.4.MSHADE-252</version>
</plugin>
{code}

Thank you.


was (Author: kriegaex):
Nobody has reacted to my pull request on GitHub. [~elharo], [~hboutemy], I see you committing to that project sometimes. [~olamy], I saw that you worked on the source code shading feature before. Sorry to ask you all directly, but would you please review my PR and merge it, if possible? I think it is a big improvement.

Meanwhile, if anybody would like to test my fix with regard to this issue, you can use it like this:
 {code:xml}
<pluginRepositories>
  <!-- TODO: Remove after upstream release for Maven Shade with fix for MSHADE-252 -->
  <pluginRepository>
    <id>github</id>
    <name>GitHub Packages</name>
    <url>https://maven.pkg.github.com/kriegaex/aspectj-packages</url>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </pluginRepository>
</pluginRepositories>

<!-- (...) -->

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <!-- TODO: Replace by release in which https://issues.apache.org/jira/browse/MSHADE-252 is fixed -->
  <version>3.2.4.MSHADE-252</version>
</plugin>
{code}

Thank you.

> shadeSourcesContent is broken when combined with partial relocation
> -------------------------------------------------------------------
>
>                 Key: MSHADE-252
>                 URL: https://issues.apache.org/jira/browse/MSHADE-252
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 2.4.3, 3.0.0
>            Reporter: Zhenyu Yang
>            Priority: Major
>              Labels: easyfix
>
> per description in https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#shadeSourcesContent, when set it to true,
> "it will attempt to shade the contents of the java source files when creating the sources jar." However, it seems will blindly shade all the source files include those are excluded from relocation rules.
> This could be illustrated with a simple example:
> Assume there are two classes defined in two packages as below:
> {code:title=A.java}
> package com.fake.fooA;
> import com.fake.fooB;
> public Class A {}
> {code}
> {code:title=B.java}
> package com.fake.fooB;
> import com.fake.fooA;
> public class B {}
> {code}
> and the maven config looks like:
> {code:xml}
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-shade-plugin</artifactId>
>         <version>2.4.3</version>
>         <executions>
>           <!-- Run shade goal on package phase -->
>           <execution>
>             <phase>package</phase>
>             <goals>
>               <goal>shade</goal>
>             </goals>
>             <configuration>
>               <shadedArtifactAttached>false</shadedArtifactAttached>
>               <createSourcesJar>true</createSourcesJar>
>               <shadeSourcesContent>true</shadeSourcesContent>
>               <relocations>
>                 <relocation>
>                   <pattern>com.fake</pattern>
>                   <shadedPattern>.com.fake.shaded</shadedPattern>
>                   <excludes>
>                     <exclude>com.fake.fooA.*</exclude>
>                   </excludes>
>                 </relocation>
>                </relocations>
> {code}
> Then the shade plugin will modify the B's source file to be:
> {code}
> package com.fake.shaded.fooB;
> import com.fake.shaded.fooA;
> public class B {}
> {code}
> Notice that package A's path was also updated, which is wrong as it's not got relocated.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)