You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jurgen De Landsheer <ju...@ugent.be> on 2006/04/19 14:18:17 UTC

[m2] dependency tree

how can I build a tree of dependencies, take this example

//***************
<project>
    <groupId>group1</groupId>
    <artifactId>artifact1</artifactId>
    <version>1.0</version>
    <packaging>pom</packaging>
    ...
    <dependencies>
        <dependency>
            <groupId>dependency1group</groupId>
            <artifactId>dependency1artifact</artifactId>
             <version>1.0</version>
        </dependency>
    </dependencies>
</project>

//***************
<project>
    <parent>
        <groupId>group1</groupId>
        <artifactId>artifact1</artifactId>
        <version>1.0</version>
    </parent>
    <groupId>group2</groupId>
    <artifactId>artifact2</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    ...
    <dependencies>
        <dependency>
            <groupId>dependency2group</groupId>
            <artifactId>dependency2artifact</artifactId>
             <version>2.0</version>
        </dependency>
    </dependencies>
</project>

//***************
<project>
    <groupId>dependency2group</groupId>
    <artifactId>dependency2artifact</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>
    ...
    <dependencies>
        <dependency>
            <groupId>dependency3group</groupId>
            <artifactId>dependency3artifact</artifactId>
             <version>3.0</version>
        </dependency>
    </dependencies>
</project>

//***************

I would like to have something like this (possibly 
compile/runtime/compile&runtime scope) (just like you would read the 
pom.xml of each projects, it's parent, and those from the dependencies 
in each)

artifact: group2:artifact2:1.0
(
    |--> ...                                                             
                        (parent of parent of parent)
    |--> ...                                                             
                        (parent of parent)
)
    |--> group1:artifact1:1.0                                           
                  (parent project)
          |--> dependency1group:dependency1artifact:1.0                  
(dependencies of parent project)
              |--> ...                                                   
                            (dependencies of a dependency of the parent 
project)
          |--> ...
              |--> ...
    |--> dependency2group:dependency2artifact:2.0                     
    (dependencies of this project)
          |--> dependency3group:dependency3artifact:3.0                  
  (dependencies of a dependency)
          |--> ...
   |--> ...



I know you can get the parent project via
     MavenProject thisProject = ${project};
     MavenProject parentProject = thisProject.getParent();
     Artifact backingArtifact = xProject.getArtifact(); // packaging = 
pom => null  ;   packaging = jar => Artifact
     List<Artifact> compileArtifacts = xProject.getCompileArtifacts();
     List<Artifact> runtimeArtifacts = xProject.getRuntimeArtifacts();
     List<Dependency> compileDependencies = 
xProject.getCompileDependencies();
     List<Dependency> runtimeDependencies = 
xProject.getRuntimeDependencies();

but these functions include all dependencies/artifacts at once and no 
one in the parent project

  
pls help me



-- 


met vriendelijke groeten




Re: [m2] dependency tree

Posted by Kenney Westerhof <ke...@apache.org>.
On Wed, 19 Apr 2006, Jurgen De Landsheer wrote:

> and development of plugins?
> which I intend to do

Hm, well yes, I think that for those questions this list is more accurate
- questions about the API. I'm sorry about that.


> (de user list is voor gebruik en dit voor development, niet?)

The dev list is primarily meant for development on Maven itself,
not on developing _with_ maven.. but it's pretty vague..

Anyway, I think you're trying to do something like this:

http://mojo.codehaus.org/graphing-maven-plugin/

although that's not even nearly finished.

Have a look at the pomtools-maven-plugin:
http://mojo.codehaus.org/pomtools-maven-plugin/

It uses some of mavens core functionality to resolve the dependencies
itself, because information about where dependencies came from is
lost in the MavenProject object.

-- Kenney

>
>
> Kenney Westerhof wrote:
>
> >On Wed, 19 Apr 2006, Jurgen De Landsheer wrote:
> >
> >Please use the user list for user questions, as this list is meant
> >for discussion of development on the Maven project itself / Gelieve de
> >user list te gebruiken voor gebruikersvragen omdat deze lijst
> >alleen bedoeld is voor de ontwikkeling van Maven zelf ( :-) )
> >
> >Greetings,
> >
> >	Kenney
> >
> >
> >
> >>how can I build a tree of dependencies, take this example
> >>
> >>//***************
> >><project>
> >>    <groupId>group1</groupId>
> >>    <artifactId>artifact1</artifactId>
> >>    <version>1.0</version>
> >>    <packaging>pom</packaging>
> >>    ...
> >>    <dependencies>
> >>        <dependency>
> >>            <groupId>dependency1group</groupId>
> >>            <artifactId>dependency1artifact</artifactId>
> >>             <version>1.0</version>
> >>        </dependency>
> >>    </dependencies>
> >></project>
> >>
> >>//***************
> >><project>
> >>    <parent>
> >>        <groupId>group1</groupId>
> >>        <artifactId>artifact1</artifactId>
> >>        <version>1.0</version>
> >>    </parent>
> >>    <groupId>group2</groupId>
> >>    <artifactId>artifact2</artifactId>
> >>    <version>1.0</version>
> >>    <packaging>jar</packaging>
> >>    ...
> >>    <dependencies>
> >>        <dependency>
> >>            <groupId>dependency2group</groupId>
> >>            <artifactId>dependency2artifact</artifactId>
> >>             <version>2.0</version>
> >>        </dependency>
> >>    </dependencies>
> >></project>
> >>
> >>//***************
> >><project>
> >>    <groupId>dependency2group</groupId>
> >>    <artifactId>dependency2artifact</artifactId>
> >>    <version>1.0</version>
> >>    <packaging>jar</packaging>
> >>    ...
> >>    <dependencies>
> >>        <dependency>
> >>            <groupId>dependency3group</groupId>
> >>            <artifactId>dependency3artifact</artifactId>
> >>             <version>3.0</version>
> >>        </dependency>
> >>    </dependencies>
> >></project>
> >>
> >>//***************
> >>
> >>I would like to have something like this (possibly
> >>compile/runtime/compile&runtime scope) (just like you would read the
> >>pom.xml of each projects, it's parent, and those from the dependencies
> >>in each)
> >>
> >>artifact: group2:artifact2:1.0
> >>(
> >>    |--> ...
> >>                        (parent of parent of parent)
> >>    |--> ...
> >>                        (parent of parent)
> >>)
> >>    |--> group1:artifact1:1.0
> >>                  (parent project)
> >>          |--> dependency1group:dependency1artifact:1.0
> >>(dependencies of parent project)
> >>              |--> ...
> >>                            (dependencies of a dependency of the parent
> >>project)
> >>          |--> ...
> >>              |--> ...
> >>    |--> dependency2group:dependency2artifact:2.0
> >>    (dependencies of this project)
> >>          |--> dependency3group:dependency3artifact:3.0
> >>  (dependencies of a dependency)
> >>          |--> ...
> >>   |--> ...
> >>
> >>
> >>
> >>I know you can get the parent project via
> >>     MavenProject thisProject = ${project};
> >>     MavenProject parentProject = thisProject.getParent();
> >>     Artifact backingArtifact = xProject.getArtifact(); // packaging =
> >>pom => null  ;   packaging = jar => Artifact
> >>     List<Artifact> compileArtifacts = xProject.getCompileArtifacts();
> >>     List<Artifact> runtimeArtifacts = xProject.getRuntimeArtifacts();
> >>     List<Dependency> compileDependencies =
> >>xProject.getCompileDependencies();
> >>     List<Dependency> runtimeDependencies =
> >>xProject.getRuntimeDependencies();
> >>
> >>but these functions include all dependencies/artifacts at once and no
> >>one in the parent project
> >>
> >>
> >>pls help me
> >>
> >>
> >>
> >>--
> >>
> >>
> >>met vriendelijke groeten
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >--
> >Kenney Westerhof
> >http://www.neonics.com
> >GPG public key: http://www.gods.nl/~forge/kenneyw.key
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
> >
>
>
> --
>
>
> met vriendelijke groeten
>
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

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


Re: [m2] dependency tree

Posted by Jurgen De Landsheer <ju...@ugent.be>.
and development of plugins?
which I intend to do

(de user list is voor gebruik en dit voor development, niet?)


Kenney Westerhof wrote:

>On Wed, 19 Apr 2006, Jurgen De Landsheer wrote:
>
>Please use the user list for user questions, as this list is meant
>for discussion of development on the Maven project itself / Gelieve de
>user list te gebruiken voor gebruikersvragen omdat deze lijst
>alleen bedoeld is voor de ontwikkeling van Maven zelf ( :-) )
>
>Greetings,
>
>	Kenney
>
>  
>
>>how can I build a tree of dependencies, take this example
>>
>>//***************
>><project>
>>    <groupId>group1</groupId>
>>    <artifactId>artifact1</artifactId>
>>    <version>1.0</version>
>>    <packaging>pom</packaging>
>>    ...
>>    <dependencies>
>>        <dependency>
>>            <groupId>dependency1group</groupId>
>>            <artifactId>dependency1artifact</artifactId>
>>             <version>1.0</version>
>>        </dependency>
>>    </dependencies>
>></project>
>>
>>//***************
>><project>
>>    <parent>
>>        <groupId>group1</groupId>
>>        <artifactId>artifact1</artifactId>
>>        <version>1.0</version>
>>    </parent>
>>    <groupId>group2</groupId>
>>    <artifactId>artifact2</artifactId>
>>    <version>1.0</version>
>>    <packaging>jar</packaging>
>>    ...
>>    <dependencies>
>>        <dependency>
>>            <groupId>dependency2group</groupId>
>>            <artifactId>dependency2artifact</artifactId>
>>             <version>2.0</version>
>>        </dependency>
>>    </dependencies>
>></project>
>>
>>//***************
>><project>
>>    <groupId>dependency2group</groupId>
>>    <artifactId>dependency2artifact</artifactId>
>>    <version>1.0</version>
>>    <packaging>jar</packaging>
>>    ...
>>    <dependencies>
>>        <dependency>
>>            <groupId>dependency3group</groupId>
>>            <artifactId>dependency3artifact</artifactId>
>>             <version>3.0</version>
>>        </dependency>
>>    </dependencies>
>></project>
>>
>>//***************
>>
>>I would like to have something like this (possibly
>>compile/runtime/compile&runtime scope) (just like you would read the
>>pom.xml of each projects, it's parent, and those from the dependencies
>>in each)
>>
>>artifact: group2:artifact2:1.0
>>(
>>    |--> ...
>>                        (parent of parent of parent)
>>    |--> ...
>>                        (parent of parent)
>>)
>>    |--> group1:artifact1:1.0
>>                  (parent project)
>>          |--> dependency1group:dependency1artifact:1.0
>>(dependencies of parent project)
>>              |--> ...
>>                            (dependencies of a dependency of the parent
>>project)
>>          |--> ...
>>              |--> ...
>>    |--> dependency2group:dependency2artifact:2.0
>>    (dependencies of this project)
>>          |--> dependency3group:dependency3artifact:3.0
>>  (dependencies of a dependency)
>>          |--> ...
>>   |--> ...
>>
>>
>>
>>I know you can get the parent project via
>>     MavenProject thisProject = ${project};
>>     MavenProject parentProject = thisProject.getParent();
>>     Artifact backingArtifact = xProject.getArtifact(); // packaging =
>>pom => null  ;   packaging = jar => Artifact
>>     List<Artifact> compileArtifacts = xProject.getCompileArtifacts();
>>     List<Artifact> runtimeArtifacts = xProject.getRuntimeArtifacts();
>>     List<Dependency> compileDependencies =
>>xProject.getCompileDependencies();
>>     List<Dependency> runtimeDependencies =
>>xProject.getRuntimeDependencies();
>>
>>but these functions include all dependencies/artifacts at once and no
>>one in the parent project
>>
>>
>>pls help me
>>
>>
>>
>>--
>>
>>
>>met vriendelijke groeten
>>
>>
>>
>>
>>    
>>
>
>--
>Kenney Westerhof
>http://www.neonics.com
>GPG public key: http://www.gods.nl/~forge/kenneyw.key
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>For additional commands, e-mail: dev-help@maven.apache.org
>
>  
>


-- 


met vriendelijke groeten



Re: [m2] dependency tree

Posted by Kenney Westerhof <ke...@apache.org>.
On Wed, 19 Apr 2006, Jurgen De Landsheer wrote:

Please use the user list for user questions, as this list is meant
for discussion of development on the Maven project itself / Gelieve de
user list te gebruiken voor gebruikersvragen omdat deze lijst
alleen bedoeld is voor de ontwikkeling van Maven zelf ( :-) )

Greetings,

	Kenney

> how can I build a tree of dependencies, take this example
>
> //***************
> <project>
>     <groupId>group1</groupId>
>     <artifactId>artifact1</artifactId>
>     <version>1.0</version>
>     <packaging>pom</packaging>
>     ...
>     <dependencies>
>         <dependency>
>             <groupId>dependency1group</groupId>
>             <artifactId>dependency1artifact</artifactId>
>              <version>1.0</version>
>         </dependency>
>     </dependencies>
> </project>
>
> //***************
> <project>
>     <parent>
>         <groupId>group1</groupId>
>         <artifactId>artifact1</artifactId>
>         <version>1.0</version>
>     </parent>
>     <groupId>group2</groupId>
>     <artifactId>artifact2</artifactId>
>     <version>1.0</version>
>     <packaging>jar</packaging>
>     ...
>     <dependencies>
>         <dependency>
>             <groupId>dependency2group</groupId>
>             <artifactId>dependency2artifact</artifactId>
>              <version>2.0</version>
>         </dependency>
>     </dependencies>
> </project>
>
> //***************
> <project>
>     <groupId>dependency2group</groupId>
>     <artifactId>dependency2artifact</artifactId>
>     <version>1.0</version>
>     <packaging>jar</packaging>
>     ...
>     <dependencies>
>         <dependency>
>             <groupId>dependency3group</groupId>
>             <artifactId>dependency3artifact</artifactId>
>              <version>3.0</version>
>         </dependency>
>     </dependencies>
> </project>
>
> //***************
>
> I would like to have something like this (possibly
> compile/runtime/compile&runtime scope) (just like you would read the
> pom.xml of each projects, it's parent, and those from the dependencies
> in each)
>
> artifact: group2:artifact2:1.0
> (
>     |--> ...
>                         (parent of parent of parent)
>     |--> ...
>                         (parent of parent)
> )
>     |--> group1:artifact1:1.0
>                   (parent project)
>           |--> dependency1group:dependency1artifact:1.0
> (dependencies of parent project)
>               |--> ...
>                             (dependencies of a dependency of the parent
> project)
>           |--> ...
>               |--> ...
>     |--> dependency2group:dependency2artifact:2.0
>     (dependencies of this project)
>           |--> dependency3group:dependency3artifact:3.0
>   (dependencies of a dependency)
>           |--> ...
>    |--> ...
>
>
>
> I know you can get the parent project via
>      MavenProject thisProject = ${project};
>      MavenProject parentProject = thisProject.getParent();
>      Artifact backingArtifact = xProject.getArtifact(); // packaging =
> pom => null  ;   packaging = jar => Artifact
>      List<Artifact> compileArtifacts = xProject.getCompileArtifacts();
>      List<Artifact> runtimeArtifacts = xProject.getRuntimeArtifacts();
>      List<Dependency> compileDependencies =
> xProject.getCompileDependencies();
>      List<Dependency> runtimeDependencies =
> xProject.getRuntimeDependencies();
>
> but these functions include all dependencies/artifacts at once and no
> one in the parent project
>
>
> pls help me
>
>
>
> --
>
>
> met vriendelijke groeten
>
>
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

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