Howdy Mathias,

well, first to clear up: maven-resolver does NOT support operations like
"resolve me this artifact HERE". The "local repository" is coupled with it,
and resolution of artifacts always happens from remote to local repository,
and then the result handles you the java.io.File of the resulting operation.

What you can do, is to modify the local repository for example, but then
you have to be aware that in that case you start with "tabula rasa", that
repository will be empty (like when you "nuke" your local repository).

Resolver sadly does not support "resolve into memory" either, so all you
can do today is to create a temporary local repository and resolve there,
process the file(s) resolved, and finally nuke the temporary local
repository.

This is exactly what happens in m-assembly-p (except it uses deprecated
maven-artifact-transfer (MAT) to support org.sonatype/org.eclipse resolver,
something you don't need, as maven 3.0 is NOT supported anymore by
m-deploy-p).

MAT does this to "redirect" local repo:
https://github.com/apache/maven-artifact-transfer/blob/master/maven-3.1.x/src/main/java/org/apache/maven/shared/transfer/repository/internal/Maven31RepositoryManager.java#L106-L119

But as Laeubi wrote, ForwardingSession will do as well.

HTH
T

On Tue, Sep 27, 2022 at 10:34 AM Mathias de Riese <math...@de-riese.de>
wrote:

> Hi,
>
> if it exists on the remote repo, I would like to retrieve the POM of the
> current project in order to compare it with a local version.
>
> As answered yesterday to a question of Christoph Läubrich, the right entry
> point for this seems to be org.eclipse.aether.RepositorySystem. However, it
> only offers `resolveArtifact()` which does not let me specify the path and
> might return the POM from the local repository...
>
> If I dig deeper I find
> org.eclipse.aether.spi.connector.RepositoryConnector which might do the
> job. However, it is part of the SPI and not the API.
>
> What would be the correct way to retrieve a artifact (or specifically a
> POM) to a temporary file or into memory?
>
> What am I trying to do? Implementing
> https://issues.apache.org/jira/browse/MDEPLOY-118. By the way: I am still
> patiently waiting for an answer to my previous question, whether you would
> be interested in a pull request for that issue.
>
> Regards,
> Mathias
>
>

Reply via email to