You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Karl Heinz Marbaise (JIRA)" <ji...@apache.org> on 2018/04/10 15:13:00 UTC

[jira] [Commented] (MSHADE-287) honor classpath order

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

Karl Heinz Marbaise commented on MSHADE-287:
--------------------------------------------

Maybe I misunderstand a thing based on your example if a resource for example a property file (with the same name and location) which is in {{a.jar}} as well as in {{b.jar}} the first one which is found on the classpath will be loaded which is If I correctly understand your problem independent of maven-shade-plugin....The order on the classpath in your example is defined by the given order on command line? So maven-shade can not influence this...cause that's based on JVM itself...

Building an ueber jar which contains all jars of a lib would result in a jar which contains all classes inside the jar...The order on the classpath ? To be honest I don't know it...But I have my doubts that is possible having a defined order cause all class files are within the same jar ....and within a jar I'm not sure if it is possible having a defined classpath order ...furthermore the question why do you need an defined order within the ueber jar?


> honor classpath order
> ---------------------
>
>                 Key: MSHADE-287
>                 URL: https://issues.apache.org/jira/browse/MSHADE-287
>             Project: Maven Shade Plugin
>          Issue Type: Improvement
>            Reporter: Jürgen Weber
>            Priority: Major
>
> Shade Plugin should be able to honor classpath order semantics: -cp a.jar:b.jar has the effect that resources in b.jar are not visible if also in a.jar
> It should be possible to have the same effect with Shade Plugin: iterate for last to first in classpath: extract current element overwriting content of previous extracted.
> use case:
> running an app with Maven has a defined classpath order, whereas the order of jars in WEB-INF/lib is rather random. So you could build an ueber jar containing all jars of lib which would result in the desired class order.
> This is currently not possible with org.apache.maven.plugins.shade.ShadeRequest as the input jars are in a java.util.Set which has no order.
> See 
> [https://stackoverflow.com/questions/4466526/order-of-class-loading-from-a-war-file]
> [https://stackoverflow.com/questions/2021227/control-the-classpath-ordering-of-jars-in-web-inf-lib-on-tomcat-5]
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)