You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by lukewpatterson <lu...@gmail.com> on 2010/02/18 15:19:24 UTC

API to find "effective-direct" dependencies

-- It was suggested [1] that I ask this question in a new thread, it might
have gotten lost in the noise --

I'm looking for existing API that will give me a MavenProject's
"effective-direct" dependencies, taking into account "grouped dependencies"
[2].

By "effective-direct" dependencies, I mean: all direct and all directly
listed in pom dependencies (recursively in pom dependencies, e.g. if pom
dependency has pom dependency)

I can get either direct-only [3] or all (direct and transitive) [4]
dependencies from MavenProject, but I don't see how I can get
effective-direct dependencies.

I see there is DepedencyNode [5] API, but I don't know if that will remain
stable with Maven 3 on the way.  I was hoping someone already had this part
figured out and I could just leech off their work.

Thanks


[1]
http://old.nabble.com/Some-questions-about-%22grouped-dependencies%22-tt27615566.html#a27625014
[2]
http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html#pom-relationships-sect-grouping-deps
[3] getDependencyArtifacts() at
http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.1/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
[4] getArtifacts() at
http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.1/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
[5]
http://maven.apache.org/shared/maven-dependency-tree/apidocs/org/apache/maven/shared/dependency/tree/DependencyNode.html
-- 
View this message in context: http://old.nabble.com/API-to-find-%22effective-direct%22-dependencies-tp27637812p27637812.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: API to find "effective-direct" dependencies

Posted by lukewpatterson <lu...@gmail.com>.

ronatartifact wrote:
> 
> How is this different from what Eclipse shows?
> Can you use their code from the Pom editor?
> 

Thanks, Ron, I'll look into that too.

My initial investigations lead me to DependencyNode:
org.apache.maven.shared.dependency.tree.DependencyNode

It needs a few other components to be instantiated:
org.apache.maven.shared.dependency.tree.DependencyTreeBuilder
org.apache.maven.project.MavenProject
org.apache.maven.artifact.repository.ArtifactRepository (local repository)
org.apache.maven.artifact.factory.ArtifactFactory
org.apache.maven.artifact.metadata.ArtifactMetadataSource
org.apache.maven.artifact.resolver.filter.ArtifactFilter
org.apache.maven.artifact.resolver.ArtifactCollector

I need to check if those remain stable between Maven 2 and 3.  If I find
some answers, I'll post back.
-- 
View this message in context: http://old.nabble.com/API-to-find-%22effective-direct%22-dependencies-tp27637812p27653141.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: API to find "effective-direct" dependencies

Posted by Ron Wheeler <rw...@artifact-software.com>.
How is this different from what Eclipse shows?
Can you use their code from the Pom editor?

Ron

lukewpatterson wrote:
> -- It was suggested [1] that I ask this question in a new thread, it might
> have gotten lost in the noise --
>
> I'm looking for existing API that will give me a MavenProject's
> "effective-direct" dependencies, taking into account "grouped dependencies"
> [2].
>
> By "effective-direct" dependencies, I mean: all direct and all directly
> listed in pom dependencies (recursively in pom dependencies, e.g. if pom
> dependency has pom dependency)
>
> I can get either direct-only [3] or all (direct and transitive) [4]
> dependencies from MavenProject, but I don't see how I can get
> effective-direct dependencies.
>
> I see there is DepedencyNode [5] API, but I don't know if that will remain
> stable with Maven 3 on the way.  I was hoping someone already had this part
> figured out and I could just leech off their work.
>
> Thanks
>
>
> [1]
> http://old.nabble.com/Some-questions-about-%22grouped-dependencies%22-tt27615566.html#a27625014
> [2]
> http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-best-practice.html#pom-relationships-sect-grouping-deps
> [3] getDependencyArtifacts() at
> http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.1/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
> [4] getArtifacts() at
> http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.1/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
> [5]
> http://maven.apache.org/shared/maven-dependency-tree/apidocs/org/apache/maven/shared/dependency/tree/DependencyNode.html
>   


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