You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Konrad Windszus <kw...@apache.org> on 2022/08/15 07:10:58 UTC

API for resolving Maven artifacts to be used from Mojos

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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: API for resolving Maven artifacts to be used from Mojos

Posted by Tamás Cservenák <ta...@cservenak.net>.
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 <kw...@apache.org> 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: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: API for resolving Maven artifacts to be used from Mojos

Posted by Slawomir Jaranowski <s....@gmail.com>.
Hi,

1, contains methods like createArtifact, I use it for replacement for
deprecated
https://maven.apache.org/ref/3.8.6/apidocs/org/apache/maven/artifact/factory/ArtifactFactory.html
it is correct way?

We should point the correct way in code by deprecating some of
classes/interfaces with pointing replacement.


pt., 19 sie 2022 o 07:50 Konrad Windszus <kw...@apache.org> napisał(a):

> For the record:
> After talking to Michael it seems that 3. is currently the recommended
> way. For Maven 4 a new API is in the works, with a dedicated service for
> artifact resolving:
> https://github.com/apache/maven/blob/05c6ba360dda72d65ddeb35ad68d7365c1f8401e/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java
> .
>
> Konrad
>
> On 2022/08/15 07:10:58 Konrad Windszus 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: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

-- 
Sławomir Jaranowski

Re: API for resolving Maven artifacts to be used from Mojos

Posted by Konrad Windszus <kw...@apache.org>.
For the record:
After talking to Michael it seems that 3. is currently the recommended way. For Maven 4 a new API is in the works, with a dedicated service for artifact resolving: https://github.com/apache/maven/blob/05c6ba360dda72d65ddeb35ad68d7365c1f8401e/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactResolver.java.

Konrad

On 2022/08/15 07:10:58 Konrad Windszus 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: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
> 
> 

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