You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Beermann <mb...@yahoo.com> on 2007/01/03 20:39:36 UTC

Question about artifact resolution

So, I'm writing a mojo where (for various strange reasons) I need to construct and resolve Artifacts manually, during mojo execution. My first attempt at the code looked something like:

Artifact a = artifactFactory.createDependencyArtifact(...);
artifactResolver.resolve(a, ...);

This works beautifully, so long as you supply the ArtifactFactory with a /definite/ version number. If you attempt to use a version range or a keyword like RELEASE, LATEST, etc, everything blows up. From reading through the source code, the resolve() method is expecting the artifact to already have a definite version number. (There's a shortcut optimization to look directly inside the local repository before triggering a download.)

So my question is, what am I doing wrong here? How do I trigger Maven's code for locating the most appropriate version given a range/keyword/etc? Is there a helper or utility class for all of this somewhere?

--Matthew Beermann

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: Question about artifact resolution

Posted by Tom Huybrechts <to...@gmail.com>.
maybe MavenMetadataSource.retrieveAvailableVersions() or
ArtifactCollector.collect can help you

On 1/3/07, Matthew Beermann <mb...@yahoo.com> wrote:
> So, I'm writing a mojo where (for various strange reasons) I need to construct and resolve Artifacts manually, during mojo execution. My first attempt at the code looked something like:
>
> Artifact a = artifactFactory.createDependencyArtifact(...);
> artifactResolver.resolve(a, ...);
>
> This works beautifully, so long as you supply the ArtifactFactory with a /definite/ version number. If you attempt to use a version range or a keyword like RELEASE, LATEST, etc, everything blows up. From reading through the source code, the resolve() method is expecting the artifact to already have a definite version number. (There's a shortcut optimization to look directly inside the local repository before triggering a download.)
>
> So my question is, what am I doing wrong here? How do I trigger Maven's code for locating the most appropriate version given a range/keyword/etc? Is there a helper or utility class for all of this somewhere?
>
> --Matthew Beermann
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>

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