Nick,

I have to correct you, as what you wrote is not true (anymore). But first,
I think this mail was on hold by moderator, as we had a same/similar
discussion already on this thread:
https://lists.apache.org/thread/16055md5s2d5fqch5t4vkn13j7czfybr

But in short:
- since 2.0.9 dependencies ARE ordered in deterministic way (unsure how),
but since Maven 3+ they are pre-order (graph "flattened" into list, that is
then used to create CP and similar things)
- the plugins are ordered as well (and Maven 4 got or is about to get even
finer solution)
- and in above mentioned thread, this is where we at
https://issues.apache.org/jira/browse/MNG-6357?focusedCommentId=17748655&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17748655
- for the rest (overlapping classes) I do agree fully, but life is life...

HTH
T

On Fri, Jul 28, 2023 at 10:45 PM Nick Stolwijk <nick.stolw...@gmail.com>
wrote:

> Hi Mark,
>
> I don't think there is any guarantee for ordering in Maven. The
> dependencies are not ordered, the plugins in the build section are not
> ordered. I remember that with a Java upgrade the plugins were executed in a
> different ordering due to a new implementation of HashMap. (Only the
> plugins in the same phase in a lifecycle, of course). The only thing
> ordered are the phases in the lifecycle.
>
> I think it would be more feasible to make sure you don't have dependencies
> with overlapping classes (you can use the Maven Enforcer Plugin for
> that[1]). If you really need those 2 dependencies on the classpath, maybe
> you can try something with the Maven Shade Plugin, to give one of those
> dependencies their unique package names[2].
>
> [1] https://www.mojohaus.org/extra-enforcer-rules/banDuplicateClasses.html
> [2]
>
> https://maven.apache.org/plugins/maven-shade-plugin/examples/class-relocation.html
>
> Hth,
>
> Nick Stolwijk
>
> ~~~ Try to leave this world a little better than you found it and, when
> your turn comes to die, you can die happy in feeling that at any rate you
> have not wasted your time but have done your best ~~~
>
> Lord Baden-Powell
>
>
> On Fri, 28 Jul 2023 at 21:25, <mark.yagnatin...@barclays.com.invalid>
> wrote:
>
> > I already asked this question on Stack Overflow but got no takers so I'm
> > trying again here:
> >
> > Suppose I have a maven module M which declares a direct dependency on
> > modules X and Y.
> > I want the classes from X to come before classes from Y in the class
> path.
> > Is there any easy way to add a rule in maven enforcer to ensure that I
> > don't accidentally swap the order sometime in the future?
> >
> > Copied from here:
> >
> >
> https://stackoverflow.com/questions/76766623/maven-enforcer-enforce-class-path-order
> >
> >
> > This message is for information purposes only. It is not a
> recommendation,
> > advice, offer or solicitation to buy or sell a product or service, nor an
> > official confirmation of any transaction. It is directed at persons who
> are
> > professionals and is intended for the recipient(s) only. It is not
> directed
> > at retail customers. This message is subject to the terms at:
> > https://www.cib.barclays/disclosures/web-and-email-disclaimer.html.
> >
> > For important disclosures, please see:
> > https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html
> > regarding marketing commentary from Barclays Sales and/or Trading desks,
> > who are active market participants;
> >
> https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html
> > regarding our standard terms for Barclays Corporate and Investment Bank
> > where we trade with you in principal-to-principal wholesale markets
> > transactions; and in respect to Barclays Research, including disclosures
> > relating to specific issuers, see: http://publicresearch.barclays.com.
> >
> __________________________________________________________________________________
> >
> > If you are incorporated or operating in Australia, read these important
> > disclosures:
> >
> https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html
> > .
> >
> >
> __________________________________________________________________________________
> > For more details about how we use personal information, see our privacy
> > notice:
> https://www.cib.barclays/disclosures/personal-information-use.html.
> >
> >
> >
> __________________________________________________________________________________
> >
>

Reply via email to