You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/07/02 15:23:57 UTC

[GitHub] [maven-shade-plugin] rmannibucau edited a comment on pull request #59: MSHADE-373: adds a property to skip manifest transformer application when transforming a source file.

rmannibucau edited a comment on pull request #59:
URL: https://github.com/apache/maven-shade-plugin/pull/59#issuecomment-653071512


   @raphw hmm, ok, let me try to reformulate because if I get it right I tend to see the "skip" fix as a quick workaround but an inaccurate (hope next part explains why). So my understanding is that createSourcesJar leads to a duplicated manifests in 2 different jars and this is an issue for you because eclipse uses both jars in an OSGi container.
   
   My understanding of this issue leads me to these two lacks in current plugin we can fix:
   
   1. You can force a manifest entry to be ignore (I assume we can have a custom value to say 'ignore if I'm equals to X" - org.apache.maven.shade.ignore for example - and then it can be forced in manifest transformer and enables to drop manifest entries from the original manifest (thinking to OSGi -> SE fatjar case for example).
   2. Implicit source shade has no manifest customization which means in org.apache.maven.plugins.shade.mojo.ShadeMojo#createSourcesJar we fully inherit from the main shade and therefore the manifest is 1-1 with the original artifact. I would add a flag in ManifestTransformer to mimic the mojo config ("main", "source", "test", "test source")  with each one having a "manifestEntries" customization set which would enable to select the right "manifestEntries" for each shade and to users (you) to override some values. It just means we must filter per shade "phase" the right manifest but this is not something crazy IMHO. Finally, for backward compatibility, if there is no transformer for phase X we would keep using the main one.
   
   Here is a pseudo config illustrating that:
   
       <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
           <mainClass>net.bytebuddy.build.Plugin$Engine$Default</mainClass>
       </transformer>
       <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" forShade="sources">
           <manifestEntries></manifestEntries> <!-- set what you need -->
       </transformer>
       <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" forShade="test" />
       <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer" forShade="test-sources" />
   
   Does it make sense or did I get it wrong?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org