Michael, Have a look at my Maven Repository Provisioner codebase. It does exactly what you want and also includes dependencies and upload to a repo manager.
It now uses the Maven Resolver in the latest version so its up to date.. https://github.com/simpligility/maven-repository-tools Specifically look at https://github.com/simpligility/maven-repository-tools/blob/master/maven-repository-provisioner/src/main/java/com/simpligility/maven/provisioner/ArtifactRetriever.java Manfred simpligility.com Michael Lipp wrote on 2019-04-06 06:07: > 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-unsubscr...@maven.apache.org > For additional commands, e-mail: dev-h...@maven.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For additional commands, e-mail: dev-h...@maven.apache.org