You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Alin Dreghiciu <ad...@gmail.com> on 2007/03/23 15:04:03 UTC

What is getArtifacts() method of MavenProject returning?

Hi guys,

Can someone enlight me and tell what will the method getArtifacts from
MavenProject return? What Artifacts?

Alin Dreghiciu

Re: What is getArtifacts() method of MavenProject returning?

Posted by Carlos Sanchez <ca...@apache.org>.
Thanks Daniel, that's right, Maven populates the dependencies lazily
so it's going to depend  on what phases have you run.

On 3/23/07, Daniel Kulp <dk...@apache.org> wrote:
> On Friday 23 March 2007 12:28, Carlos Sanchez wrote:
> > there's no order guaranteed afaik, the returned object is a Set
> >
> > I think in 2.0.5 there was an attempt to make it follow the pom order
> > http://jira.codehaus.org/browse/MNG-1412
> >
> > getArtifacts returns all dependencies (including transitive)
> > Set<Artifact> i'm gonna add some javadocs
>
> Umm...  that's not complely true.  :-)
>
> Based on experience with Remote Resources, getArtifacts(...) returns the
> set of dependencies (including transitive) that were last resolved.
> Thus, the set thus then depends one either:
>
> 1) What you have set for your mojo's @requiresDependencyResolution tag.
> If you have it set to "runtime", it will be the runtime stuff.
>
> 2) If you don't have a @requiresDependencyResolution tag, it will depend
> on where in the lifecycle your plugin runs and what plugins were called
> before it.   For example, if your plugin runs in the validate phase, the
> set is most likely going to be "null".    If you run after compile,
> you'll get the compile stuff, if you run after test, you'll get the test
> stuff.
>
>
> Dan
>
>
> > On 3/23/07, Alin Dreghiciu <ad...@gmail.com> wrote:
> > > Hi guys,
> > >
> > > Can someone enlight me and tell what will the method getArtifacts
> > > from MavenProject return? What Artifacts?
> > >
> > > Alin Dreghiciu
>
> --
> J. Daniel Kulp
> Principal Engineer
> IONA
> P: 781-902-8727    C: 508-380-7194
> daniel.kulp@iona.com
> http://www.dankulp.com/blog
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


-- 
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

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


Re: What is getArtifacts() method of MavenProject returning?

Posted by Daniel Kulp <dk...@apache.org>.
On Friday 23 March 2007 12:28, Carlos Sanchez wrote:
> there's no order guaranteed afaik, the returned object is a Set
>
> I think in 2.0.5 there was an attempt to make it follow the pom order
> http://jira.codehaus.org/browse/MNG-1412
>
> getArtifacts returns all dependencies (including transitive)
> Set<Artifact> i'm gonna add some javadocs

Umm...  that's not complely true.  :-)

Based on experience with Remote Resources, getArtifacts(...) returns the 
set of dependencies (including transitive) that were last resolved.    
Thus, the set thus then depends one either:

1) What you have set for your mojo's @requiresDependencyResolution tag. 
If you have it set to "runtime", it will be the runtime stuff.

2) If you don't have a @requiresDependencyResolution tag, it will depend 
on where in the lifecycle your plugin runs and what plugins were called 
before it.   For example, if your plugin runs in the validate phase, the 
set is most likely going to be "null".    If you run after compile, 
you'll get the compile stuff, if you run after test, you'll get the test 
stuff.  


Dan


> On 3/23/07, Alin Dreghiciu <ad...@gmail.com> wrote:
> > Hi guys,
> >
> > Can someone enlight me and tell what will the method getArtifacts
> > from MavenProject return? What Artifacts?
> >
> > Alin Dreghiciu

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

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


Re: What is getArtifacts() method of MavenProject returning?

Posted by Carlos Sanchez <ca...@apache.org>.
there's no order guaranteed afaik, the returned object is a Set

I think in 2.0.5 there was an attempt to make it follow the pom order
http://jira.codehaus.org/browse/MNG-1412

getArtifacts returns all dependencies (including transitive)
Set<Artifact> i'm gonna add some javadocs


On 3/23/07, Alin Dreghiciu <ad...@gmail.com> wrote:
> Hi guys,
>
> Can someone enlight me and tell what will the method getArtifacts from
> MavenProject return? What Artifacts?
>
> Alin Dreghiciu
>


-- 
I could give you my word as a Spaniard.
No good. I've known too many Spaniards.
                             -- The Princess Bride

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