Hi,

we must be clear about the naming: an artifact can never have a version range; it is a maven coordinate which results in one file. However, a dependency can have a version range, that's the proper way to get the range resolved and get the matching artifact.

Robert


On Mon, 26 Dec 2016 08:33:59 +0100, Dan Tran <[email protected]> wrote:

to elaborate my use case: where i started with maven GAV as string,
convert to maven artifact, and finally resolve with option to change local
repo path

Thanks

-Dan

On Sun, Dec 25, 2016 at 11:31 PM, Dan Tran <[email protected]> wrote:

Thanks, I am able to obtain ProjectBuildingRequest  either with
MavenSession or MavenProject, however, there are 2 issues

  1. version range does not work, stepping the debugger show no sign of
processing resolveVersionRanges flag. and aether throws exception

  2. Looks like ProjectBuildingRequest is immutable, i cant override
localRepository as resolve time. I can do so with ArtifactResolver from
maven-compat


Thanks

-Dan

On Sun, Dec 25, 2016 at 10:50 PM, Guillaume Boué <[email protected]> wrote:

If you're inside a Maven plugin, you can get a ProjectBuildingRequest
with the session.

https://maven.apache.org/ref/3.3.9/maven-core/apidocs/org/ap
ache/maven/execution/MavenSession.html#getProjectBuildingRequest()

The shared ArtifactResolver from maven-artifact-transfer should resolve
version ranges, yes.



Le 26/12/2016 à 03:59, Dan Tran a écrit :

I found  org.apache.maven.shared.artifact.resolve.ArtifactResolver
 with
input of ProjectBuildingRequest

here is how I construct the request

             ProjectBuildingRequest req = new
DefaultProjectBuildingRequest();
             req.setLocalRepository(localRepository);
             req.setRemoteRepositories(remoteRepositories);
             req.setResolveVersionRanges(true);
             req.setRepositorySession(???);//fixme

I have access to both local and remote repos instances,

How do I obtain a repositorySession?

Thanks

-Dan


On Sun, Dec 25, 2016 at 10:45 AM, Dan Tran <[email protected]> wrote:

Hi

Does maven-artifact-transfer have this feature? if so which api?

basically, I have an org.apache.maven.artifact.Artifact with version
range set.  I need to resolve it to pickup the matching version
available
at maven repo

the org.apache.maven.artifact.resolver.ArtifactResolver from
maven-compat cant resolve it


Thanks

-Dan



---
L'absence de virus dans ce courrier électronique a été vérifiée par le
logiciel antivirus Avast.
https://www.avast.com/antivirus


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to