You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Asaf Mesika <as...@gmail.com> on 2012/04/01 07:53:54 UTC

Converting an Artifact (Aether) to MavenProject

Hi,

I'm writing a Mojo, and I have a question:

I have a piece of code which resolves an Aether Artifact based on its GAV
string, from specific repository defined programmatic.

Once I have the "org.sonatype.aether.artifact.Artifact"  at hand - how do I
convert it to a MavenProject  or any other pojo which enables me to
interrogate it's pom:
Get a list of its dependencies and transitive dependencies, its SCM info,
etc?

It's worth noting my mojo is running with @requiresProject false


Thanks!

Asaf

Re: Converting an Artifact (Aether) to MavenProject

Posted by Sascha Vogt <sa...@gmail.com>.
Hi Asaf,

Am 01.04.2012 22:50, schrieb Asaf Mesika:
> Hi,
> 
> Works great! I have the MavenProject, but since I'm running
> project-less(@requiresProject false), the lazy initialized dependency
> artifacts are not present. What API should I use to obtain the entire
> dependency (direct and transitive) for the obtain MavenProject?
As you're already using Aether, maybe you can use some snippets from them?

E.g.
http://git.eclipse.org/c/aether/aether-demo.git/tree/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/ResolveTransitiveDependencies.java

Greetings
-Sascha-

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


Re: Converting an Artifact (Aether) to MavenProject

Posted by Asaf Mesika <as...@gmail.com>.
Hi,

Works great! I have the MavenProject, but since I'm running project-less(@requiresProject false), the lazy initialized dependency artifacts are not present. 
What API should I use to obtain the entire dependency (direct and transitive) for the obtain MavenProject?

Thanks!

Asaf 

-- 
Asaf Mesika
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)


On Sunday 1 April 2012 at 14:37, Vincent Latombe wrote:

> Hello,
> 
> once resolved, get the File using
> org.sonatype.aether.artifact.Artifact#getFile
> 
> then use org.apache.maven.project.ProjectBuilder#build(File,
> ProjectBuildingRequest) to get the MavenProject.
> 
> Vincent
> 
> 
> 2012/4/1 Asaf Mesika <asaf.mesika@gmail.com (mailto:asaf.mesika@gmail.com)>
> 
> > Hi,
> > 
> > I'm writing a Mojo, and I have a question:
> > 
> > I have a piece of code which resolves an Aether Artifact based on its GAV
> > string, from specific repository defined programmatic.
> > 
> > Once I have the "org.sonatype.aether.artifact.Artifact" at hand - how do I
> > convert it to a MavenProject or any other pojo which enables me to
> > interrogate it's pom:
> > Get a list of its dependencies and transitive dependencies, its SCM info,
> > etc?
> > 
> > It's worth noting my mojo is running with @requiresProject false
> > 
> > 
> > Thanks!
> > 
> > Asaf 


Re: Converting an Artifact (Aether) to MavenProject

Posted by Vincent Latombe <vi...@gmail.com>.
Hello,

once resolved, get the File using
org.sonatype.aether.artifact.Artifact#getFile

then use org.apache.maven.project.ProjectBuilder#build(File,
ProjectBuildingRequest) to get the MavenProject.

Vincent


2012/4/1 Asaf Mesika <as...@gmail.com>

> Hi,
>
> I'm writing a Mojo, and I have a question:
>
> I have a piece of code which resolves an Aether Artifact based on its GAV
> string, from specific repository defined programmatic.
>
> Once I have the "org.sonatype.aether.artifact.Artifact"  at hand - how do I
> convert it to a MavenProject  or any other pojo which enables me to
> interrogate it's pom:
> Get a list of its dependencies and transitive dependencies, its SCM info,
> etc?
>
> It's worth noting my mojo is running with @requiresProject false
>
>
> Thanks!
>
> Asaf
>