I'm kind of glad you didn't notice ... I appreciated a peek behind the scenes :)
Re: effective POM ... THANK YOU for that bit of info.
You just saved me some un-countably large number of hours

-----Original Message-----
From: Tamás Cservenák <ta...@cservenak.net> 
Sent: Thursday, July 27, 2023 11:34 AM
To: Maven Users List <users@maven.apache.org>
Subject: Re: maven class path order documentation


CAUTION: This email originated from outside our organisation - 
ta...@cservenak.net Do not click on links, open attachments, or respond unless 
you recognize the sender and can validate the content is safe.
1 - yes
2 - yes (Maven tries hard to simplify things for users, but heh)
3 - yes, model ordering matters, most easily checked with `mvn 
help:effective-pom`, so to say if depency A is before dependency B in effective 
POM, same should be true for classpath as well.

HTH
T

PS: Sorry for bloated answers, a I just spotted that this is user ML not dev 
ML....



On Thu, Jul 27, 2023 at 5:29 PM <mark.yagnatin...@barclays.com.invalid>
wrote:

> Thank you!  I think my main takeaway here is that things (1) in flux 
> (and hopefully will improve in Maven 4) and (2) a bit complicated but
> (3) I can still guarantee something comes first by listing it as the 
> first thing in the pom (is that right?)
>
> Thanks once more!
> Mark.
>
> -----Original Message-----
> From: Tamás Cservenák <ta...@cservenak.net>
> Sent: Thursday, July 27, 2023 10:52 AM
> To: Maven Users List <users@maven.apache.org>
> Subject: Re: maven class path order documentation
>
>
> CAUTION: This email originated from outside our organisation - 
> ta...@cservenak.net Do not click on links, open attachments, or 
> respond unless you recognize the sender and can validate the content is safe.
> What a coincidence...
>
> I just started looking at an old issue (was looking at some edge 
> cases) where even reproducer exists and tackles similar topic:
>
> https://clicktime.symantec.com/15t5z3XK8nENdtkfvA1F3?h=Efy8jMRjTS28CUJ
> yvgBnMOlaMr07e6ETXpi8khKLG3k=&u=https://clicktime.symantec.com/15t6KNJ
> TXrTg4ycqwxBMc?h=jjrDqGSUIIzfItPuUlNL0cZ6EcbEUAyYjGsGWHa9PZs=&u=https:
> //issues.apache.org/jira/browse/MNG-6357
>
> Then I went to maven sources and resolver sources to ensure what is 
> happening.
>
> Sadly, maven is not quite consistent in this matter, but is at least
> aligned:
> - at some places it uses PreorderNodeListGenerator to generate 
> classpath (and/or ordered artifacts)
> - at some other places it relies on resolver ordering (that ALSO 
> implicitly uses preorder)
>
> The class in question:
>
> https://clicktime.symantec.com/15t5pP8kDYsBp16pq3Cwo?h=8f2DByrPlQLfzEc
> ejbPLFPQGuQ8TsuWhXGbnYcguXpQ=&u=https://clicktime.symantec.com/15t69hu
> tcd6VF5xzrqP4N?h=R8m2xl2plsLnGvWe4ykYwCzHW1JLzwvSPr1ZPXuWF94=&u=https:
> //github.com/apache/maven-resolver/blob/maven-resolver-1.9.14/maven-re
> solver-util/src/main/java/org/eclipse/aether/util/graph/visitor/Preord
> erNodeListGenerator.java
>
> The example output:
>
> https://clicktime.symantec.com/15t5jYwTkwBbQ4GuHUooB?h=T619edEwyisQy-K
> WGy3VvRfMFWDbZCgujjHUqdh8Wfg=&u=https://clicktime.symantec.com/15t64si
> cA1Qtq995KGyuk?h=WyCartbzFZ88lUfGKNkZl9EnZRGo4W-wpcagJX0Jv_I=&u=https:
> //gist.github.com/cstamas/ca113c1d6697540a4cf55c3098b9a550
>
> As you can see in example, the classpath is basically ordered as 
> "reading the tree", this causes that for example maven-dependency-tree 
> (2nd level
> dependency) comes BEFORE enforcer-api (1sd level) dependency.
>
> So, I myself find this wrong as well, but at least the statement you 
> found "introduced deterministic ordering of dependencies on the 
> classpath" still stands today: is PreOrder.
>
> Then occurred to me that this is easily customisable, so I went for 
> start to create this:
>
> https://clicktime.symantec.com/15t5uDL2gAYnDwvkNbc6R?h=Oo9ciO2fkPcfkh2
> 9sRGMpRA_gqMZXDNvOTPIvINgw_A=&u=https://clicktime.symantec.com/15t6EY7
> B5En5f2nvQPnCz?h=RAMVKqx23S9dHMSzavpisUWoKjVPuHmkZdU9MV01Es0=&u=https:
> //github.com/apache/maven-resolver/pull/322
>
> But this is only half of the story, as the Maven part is missing, 
> especially where Maven sorts itself...
>
> All in all, an interesting coincidence....
>
> As for your other question: what resolver does is
> - builds a "dirty tree" (graph more precisely, it may have loops), we 
> have two algorithms for this: original depth-first (DF) and new 
> breadth-first
> (BF)
> - applies conflict resolution (this is where "winners" are set, ie.
> "closest wins" in case of duplicates)
> - resulted "clean tree" is transformed into list of (resolved) 
> artifacts, possibly into classpath as well
> - OR the resolved graph is with class like (but
> consistently) PreorderNodeListGenerator used to create classpath -- so 
> PreOrder is applied always
>
> Thanks
> T
>
>
> On Thu, Jul 27, 2023 at 3:51 PM 
> <mark.yagnatin...@barclays.com.invalid>
> wrote:
>
> > Re-sending... didn't go through I think:
> >
> > In the release notes for Maven 2.0.9:
> > https://clicktime.symantec.com/15t5jYwUKYgXBMqP93PKG?h=B3zpy8Wm3QKeJ
> > 3HpKUt5HE7QUPHkZpQLqv7all73das=&u=https://clicktime.symantec.com/15t
> > 5ZtYtqhpQaAd4CN1Vw?h%3DXDVhSYMduTltP5c
> > FPTLr7pXDMQ0hXrn_euWrugDjQoo=&u=https://clicktime.symantec.com/15t5Z
> > tYuQKKLMUBY3vb22?h=D8w02CJXvYt3p0CrgusqTpmWZI3Mgd8SiFMRwZB8AZQ=&u=ht
> > tp://people.apache.org/~jvanzyl/mave
> > n-3.1.1/docs/2.0.9/release-notes.html
> > It says: "introduced deterministic ordering of dependencies on the 
> > classpath. In the past, natural set ordering was used and this lead 
> > to odd results. The ordering is now preserved from your pom, with 
> > dependencies added by inheritance added last"
> > Is this info still current?  Is it documented anywhere aside from 
> > this release note?  If not, perhaps it should be?  And more details 
> > would be nice too.  For instance:
> >
> > *         Suppose my module M has parent P and grandparent G.   Also, M
> > depends on A and B, in that order.  Further, suppose A depends on X, 
> > which in turn depends on Y.  Meanwhile, B depends on Z.
> >
> > Based on the sentence above, both of these are plausible orders:
> >
> > a.    M, A, B, X, Z, Y, P, G
> >
> > b.    M, A, X, Y, B, Z, P, G
> >
> > c.     Maybe others too?
> >
> > *         How does this relate to the dependency "mediation" algorithm
> > maven uses when there are conflicting versions of a dependency requested?
> >
> > As far as I understand, that uses a breadth-first search, where the 
> > parent pom comes FIRST rather than last.
> >
> > Does that mean that mediation algorithm is basically unrelated to 
> > class path algorithm, or do they still have some things in common?
> >
> > E.g., ordering (a) above is also a breadth-first search, whereas (b) 
> > is depth-first.
> > Any words of wisdom would be nice.
> >
> > Thanks,
> > Mark.
> >
> > 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://clicktime.symantec.com/15t6QCVjRreLhctHdwzz9?h=bKQ27fsuIx4Xxr8
> OQZlMhCTfuRly4h0r58TJEoLAo7E=&u=https://clicktime.symantec.com/15t6z1r
> jCmvRNYEEJRNYa?h=ndSuWpqyO6bHRPS-syLtQaH-4dZFuWcclGDlyPX3Cc8=&u=https:
> //www.cib.barclays/disclosures/web-and-email-disclaimer.html
> .
> >
> > For important disclosures, please see:
> > https://clicktime.symantec.com/15t5z3XKhPjJRCK9miam8?h=k4_y9ujzdz1j1
> > 6nrVezFJeJoq5M3k9F8R5-k9-qljAA=&u=https://clicktime.symantec.com/15t
> > 6KNJSyExkHg4N6PbqX?h%3Dybaw-Nh1xLrILJk
> > yXAS99Ei3SNNFFo5J2KB5vm56MtQ=&u=https://clicktime.symantec.com/15t6p
> > MUAHYZEYeaPDJaFL?h=NIrcIgESDSDmr6D72dcfoInrVnBTrEfyECT0g5EgWXE=&u=ht
> > tps://www.cib.barclays/disclosures/s
> > ales-and-trading-disclaimer.html regarding marketing commentary from 
> > Barclays Sales and/or Trading desks, who are active market 
> > participants; 
> > https://clicktime.symantec.com/15t5pP8knAN7bJfJgbnTt?h=-8Cg_lbpQDiwo
> > fHJt2LSmaf2RyFeWiW284VfqsRc3pI=&u=https://clicktime.symantec.com/15t
> > 64sibbPuy3qabTiQPf?h%3Dpy8wR1d8d73qyHD
> > DZxN0Smo58EoxOupWwqoULnWBkY0=&u=https://clicktime.symantec.com/15t6Q
> > CVjzU9GUvSmVWaWE?h=WUitfqzh_r8NBuSgphep3e3RylUpTxs1Fk-v8-5SLhs=&u=ht
> > tps://www.cib.barclays/disclosures/b
> > arclays-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:
> https://clicktime.symantec.com/15t5eikBJKVzz7SyjvQeZ?h=z7g2f34T1OXzr_V
> F4QTmGJZXpv9m8zIyTKNvfsOM2X8=&u=https://clicktime.symantec.com/15t5eik
> BrvzvmR1TbUzAe?h=OgU7Umd0iLAFb9WZ2xB8L1aZ-pGEROdbQWh6eTLYI2Y=&u=http:/
> /publicresearch.barclays.com
> .
> > ____________________________________________________________________
> > __
> > ____________
> >
> > If you are incorporated or operating in Australia, read these 
> > important
> > disclosures:
> > https://clicktime.symantec.com/15t5uDL3En3i1FVEEABcW?h=dABfUsbYEy-2y
> > AxePt7Gr-_fYvtD28H4sO4SWyIjbA0=&u=https://clicktime.symantec.com/15t
> > 69hut41bZTnQX1GoYH?h%3DD81Cbd9aEzDdnyN
> > AJdypT-1WRx8SiGvIZPkwac34Gx4=&u=https://clicktime.symantec.com/15t6Z
> > rtJuhWTJp6cadNoU?h=JWWdG2K7PBNkFCebHxrAqC5jVYU0iGm_tZCObVtpxkE=&u=ht
> > tps://www.cib.barclays/disclosures/i
> > mportant-disclosures-asia-pacific.html
> > .
> >
> > ____________________________________________________________________
> > __ ____________ For more details about how we use personal 
> > information, see our privacy
> > notice:
> https://clicktime.symantec.com/15t6EY7AWdH9sjESYqCgu?h=90zqGsD_LYA3On9
> o-jjc4H3Q7_q9NTSgvBfQvwtEecs=&u=https://clicktime.symantec.com/15t6jXG
> spvse8hkTfkB6i?h=zLvHmj1uyIDXALa1VNCHogaDWwGDOIfcMYoy_00JBDA=&u=https:
> //www.cib.barclays/disclosures/personal-information-use.html
> .
> >
> >
> > ____________________________________________________________________
> > __
> > ____________
>
> 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://clicktime.symantec.com/15t6z1rjCmvRNYEEJRNYa?h=ndSuWpqyO6bHRPS-syLtQaH-4dZFuWcclGDlyPX3Cc8=&u=https://www.cib.barclays/disclosures/web-and-email-disclaimer.html.
>
> For important disclosures, please see:
> https://clicktime.symantec.com/15t6uBfSkAEpxbQJkryPx?h=uBh3p7x4Dnef4yq
> UwF-UQKJ0FKbGOVIeTiEHWR29ckg=&u=https://www.cib.barclays/disclosures/s
> ales-and-trading-disclaimer.html regarding marketing commentary from 
> Barclays Sales and/or Trading desks, who are active market 
> participants; 
> https://clicktime.symantec.com/15t6V2h2T5prtsGh34yer?h=psvU2rRTN_wgZ38
> g59zDO-uzBw1ieLo1vinEj2TbSGY=&u=https://www.cib.barclays/disclosures/b
> arclays-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: 
> https://clicktime.symantec.com/15t5eikBrvzvmR1TbUzAe?h=OgU7Umd0iLAFb9WZ2xB8L1aZ-pGEROdbQWh6eTLYI2Y=&u=http://publicresearch.barclays.com.
> ______________________________________________________________________
> ____________
>
> If you are incorporated or operating in Australia, read these 
> important
> disclosures:
> https://clicktime.symantec.com/15t6eh5bNKC3ikvY8Bmx6?h=nBtJUJJmsckcwCq
> i_mNvHvtzZSNLzvi6mmulIdAO3B4=&u=https://www.cib.barclays/disclosures/i
> mportant-disclosures-asia-pacific.html
> .
>
> ______________________________________________________________________
> ____________ For more details about how we use personal information, 
> see our privacy
> notice: 
> https://clicktime.symantec.com/15t6jXGspvse8hkTfkB6i?h=zLvHmj1uyIDXALa1VNCHogaDWwGDOIfcMYoy_00JBDA=&u=https://www.cib.barclays/disclosures/personal-information-use.html.
>
>
> ______________________________________________________________________
> ____________

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. 
__________________________________________________________________________________

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

Reply via email to