maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Lamy <ol...@apache.org>
Subject Re: Accessing a maven repository programatically (in 2019)
Date Sun, 07 Apr 2019 09:23:39 GMT
Hi
You will find plenty of examples of how to use maven-resolver here
https://github.com/apache/maven-resolver/tree/master/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples

HTH
Olivier

On Sat, 6 Apr 2019 at 23:07, Michael Lipp <mnl@mnl.de> wrote:

> Hi,
>
> I've spent considerable time on researching this, but to no avail. The
> closest answer that I have found was on Stackoverflow
> (
> https://stackoverflow.com/questions/11674537/retrieving-maven-artifact-from-repository-using-maven-java-api
> ).
> But it points me to Eclipse Aether, which has been archived, so it seems
> out-dated and not the way to go.
>
> I also found the "Aether re-integration page"
> (http://maven.apache.org/aether.html) and had a look at "Maven Resolver
> Provider"
> (
> https://maven.apache.org/ref/3.6.0/maven-resolver-provider/apidocs/index.html?org/apache/maven/repository/internal/MavenRepositorySystemUtils.html
> ),
> the "resurrected Aether". What irritates me, however, is that there
> doesn't seem to be any connection between the "Maven Resolver Provider"
> and the main part of the API. So I wonder if this is just some "left-over".
>
> Considering the "main parts" of the Maven API, I think I should be able
> to start things by creating a LocalArtifactRepository
> (https://maven.apache.org/ref/3.6.0/apidocs/index.html), but this is, of
> course, not possible, it's abstract. The concrete subclass
> UserLocalArtifactRepository isn't of much help, it requires a repository
> as constructor argument.
>
> All other classes that implement "ArtifactRepository" are deprecated.
> Which is a pity, because something like "DefaultArtifactRepository"
> looks exactly like what I need. But I'm hesitant to start a new project
> centering around a deprecated class.
>
> So, I'm at loss. All I want to do is retrieve some artifacts and their
> POMs from a remote repository, using the ~/.m2/repository as cache, as
> usual. The ArtifactRepository interface
> (https://maven.apache.org/ref/3.6.0/apidocs/index.html) seems perfect
> for this. How can I get an object that implements it?
>
> Thanks!
>
>  - Michael
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

-- 
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message