Howdy, In maven 3 the only way to do this is using Resolver API directly (your 3. bullet). Now, as there was a mess between 3.0 and 3.1 (resolver package change), MAT (maven-artifact-transfer) was introduced to fix the gap (using reflection), but I hope Maven 3.0 can be really considered as "dead/legacy/history/unsupported", and that leaves us with Maven 3.1+ only as "maven 3", hence, your 3 should work in those cases.
Maven 4 API is in the works, but 4.0 and later ones (undefined yet until when, 4.2? 4.3? 4.5?) will still expose and hence, support Mojos directly accessing resolver APIs, as "transition period" (as mojos using the new API would be only 4+ compatible). Once API in place, and needed transition time (again, unsure yet what is "needed time") passes, Maven will _seal off_ access to its internals (including resolver) and Mojos will be able to access the (new) Maven 4 APIs ONLY. Well, in short, that's the plan, but we will see how it goes, as there is a huge proliferation of things like MAT for example, since the death of Maven 3.0 is meaningless. HTH T On Mon, Aug 15, 2022 at 9:11 AM Konrad Windszus <[email protected]> wrote: > Hi, > I found the following APIs dealing with resolving of Maven artifacts: > > 1. > https://maven.apache.org/ref/3.8.6/apidocs/org/apache/maven/repository/RepositorySystem.html > 2. > https://maven.apache.org/ref/3.8.6/apidocs/org/apache/maven/bridge/MavenRepositorySystem.html > 3. > https://maven.apache.org/resolver/apidocs/org/eclipse/aether/RepositorySystem.html > > According to https://wiki.eclipse.org/Aether/Using_Aether_in_Maven_Plugins > the API from 3. should be used in Mojos. > > There is also a TODO in > https://cwiki.apache.org/confluence/display/MAVEN/Maven+Core+Cleanup#MavenCoreCleanup-SortoutRepositorySystem/MavenRepositorySystem > related to 1. and 2. And it seems the only implementation of 1. is actually > in maven-compat (https://issues.apache.org/jira/browse/MNG-6561). The > purpose of 2. is not that clear to me, as it doesn’t even provide a method > for resolving, but only some helpers around it. > > Thanks in advance for any pointers. > Konrad > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
