You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jock924491 <Jo...@yahoo.com> on 2014/03/06 15:16:23 UTC

Maven-shade-plugin Class Overlap

I'm trying to use maven shade to overlay all of my changes to a jar on top of
another in a manner similar to a jar overlay. However there are some classes
that overlap in my source files with the jar I wish to overlap. After I
build, the ones that overlap are replaced by what is in the jar's i'm
overlaying. I want to know if it's possible to either chose the order the
jars are added or to tell it to skip any classes that overlap.



--
View this message in context: http://maven.40175.n5.nabble.com/Maven-shade-plugin-Class-Overlap-tp5787056.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven-shade-plugin Class Overlap

Posted by Wayne Fay <wa...@gmail.com>.
> Well, I can find out which are and aren't but they change every release, and
> there will be many eventually. Which the filter using include/excludes would
> be unmanageable when it gets as large as I imagine it will be

Try this experiment for me.

Make 3 jar file with content as follows:
1.jar > a.class, b.class, c.class
2.jar > c.class, d.class, e.class
3.jar > a.class, c.class, f.class

Put some text in each file so you know which "version" (1, 2, or 3)
the file represents. These don't need to be real class files, just
plain txt files.

Now play with the shade plugin configuration to see you can
predict/configure the ordering of how these files are merged together.
You want something repeatable of course. I assume there is some
implicit ordering which takes place and which you can leverage to
guarantee your later versions of these files overwrites the earlier
ones.

If you can do this, then I think you will be able to see a solution to
your own problem.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven-shade-plugin Class Overlap

Posted by Jock924491 <Jo...@yahoo.com>.
Wayne Fay wrote
> Do you know the name(s) of the files that overlap?
> If so, surely a filter that specifies them could be created.
> If not, that's the place to start.
> 
> "For fine-grained control of which classes from the selected
> dependencies are included, artifact filters can be used:"
> https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html
> 
> Wayne

Well, I can find out which are and aren't but they change every release, and
there will be many eventually. Which the filter using include/excludes would
be unmanageable when it gets as large as I imagine it will be



--
View this message in context: http://maven.40175.n5.nabble.com/Maven-shade-plugin-Class-Overlap-tp5787056p5787785.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven-shade-plugin Class Overlap

Posted by Wayne Fay <wa...@gmail.com>.
> Thanks for the reply, I was curious how would you throw together a filter
> that could handle something like that? I didn't see anything like that on
> their website.

Do you know the name(s) of the files that overlap?
If so, surely a filter that specifies them could be created.
If not, that's the place to start.

"For fine-grained control of which classes from the selected
dependencies are included, artifact filters can be used:"
https://maven.apache.org/plugins/maven-shade-plugin/examples/includes-excludes.html

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven-shade-plugin Class Overlap

Posted by Jock924491 <Jo...@yahoo.com>.
Wayne Fay wrote
> I use shade but won't pretend to be an expert on all the configuration
> options. I will assume you RTFM already.
> 
> Did you consider using class relocation to "move" the overlapping
> classes to com.dontuse? Or perhaps an artifact filter to just
> eliminate them entirely? Just thinking out loud, I'm not sure what the
> order is/should be.
> 
> Wayne

Hi there,

Thanks for the reply, I was curious how would you throw together a filter
that could handle something like that? I didn't see anything like that on
their website.



--
View this message in context: http://maven.40175.n5.nabble.com/Maven-shade-plugin-Class-Overlap-tp5787056p5787741.html
Sent from the Maven - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Maven-shade-plugin Class Overlap

Posted by Wayne Fay <wa...@gmail.com>.
> I'm trying to use maven shade to overlay all of my changes to a jar on top of
> another in a manner similar to a jar overlay. However there are some classes
> that overlap in my source files with the jar I wish to overlap. After I
> build, the ones that overlap are replaced by what is in the jar's i'm
> overlaying. I want to know if it's possible to either chose the order the
> jars are added or to tell it to skip any classes that overlap.

I use shade but won't pretend to be an expert on all the configuration
options. I will assume you RTFM already.

Did you consider using class relocation to "move" the overlapping
classes to com.dontuse? Or perhaps an artifact filter to just
eliminate them entirely? Just thinking out loud, I'm not sure what the
order is/should be.

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org