You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by David Blevins <da...@visi.com> on 2008/01/18 21:15:48 UTC

Tree/graph of Artifact objects

Is there any way to get or make a tree of Artifact objects?

I've tried taking the list of Artifacts returned from  
project.getArtifacts(), then wrapping them in my own "node" object and  
relinking them via the info in the dependency trail.  This works fine  
except that there is some information loss.  Say two artifacts (a and  
b) each depend on a thrid artifact (c).  The "c" dependency will have  
only one dependency trail showing either a or b and i'd like to see  
both trails.  I don't really need this info from the dependency trail  
specifically, just want some way to get the whole graph with no loss  
in relationships.

Any ideas?

-David



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


Re: Tree/graph of Artifact objects

Posted by Carlos Sanchez <ca...@apache.org>.
It's a graphical view of the graph ;)

On Jan 31, 2008 8:19 PM, David Blevins <da...@visi.com> wrote:
>
> On Jan 29, 2008, at 10:48 AM, Carlos Sanchez wrote:
>
> > if you want something graphical take a look at
> > http://code.google.com/p/maven-dependency-browser/
> >
> > it's going to be integrated in Q4E
> > http://code.google.com/p/q4e/issues/detail?id=144
>
> Graph as in the data structure, but thanks :)
>
> -David
>
>
> >
> > On Jan 18, 2008 12:15 PM, David Blevins <da...@visi.com>
> > wrote:
> >> Is there any way to get or make a tree of Artifact objects?
> >>
> >> I've tried taking the list of Artifacts returned from
> >> project.getArtifacts(), then wrapping them in my own "node" object
> >> and
> >> relinking them via the info in the dependency trail.  This works fine
> >> except that there is some information loss.  Say two artifacts (a and
> >> b) each depend on a thrid artifact (c).  The "c" dependency will have
> >> only one dependency trail showing either a or b and i'd like to see
> >> both trails.  I don't really need this info from the dependency trail
> >> specifically, just want some way to get the whole graph with no loss
> >> in relationships.
> >>
> >> Any ideas?
> >>
> >> -David
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
>
> ---------------------------------------------------------------------
> 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: Tree/graph of Artifact objects

Posted by David Blevins <da...@visi.com>.
On Jan 29, 2008, at 10:48 AM, Carlos Sanchez wrote:

> if you want something graphical take a look at
> http://code.google.com/p/maven-dependency-browser/
>
> it's going to be integrated in Q4E
> http://code.google.com/p/q4e/issues/detail?id=144

Graph as in the data structure, but thanks :)

-David

>
> On Jan 18, 2008 12:15 PM, David Blevins <da...@visi.com>  
> wrote:
>> Is there any way to get or make a tree of Artifact objects?
>>
>> I've tried taking the list of Artifacts returned from
>> project.getArtifacts(), then wrapping them in my own "node" object  
>> and
>> relinking them via the info in the dependency trail.  This works fine
>> except that there is some information loss.  Say two artifacts (a and
>> b) each depend on a thrid artifact (c).  The "c" dependency will have
>> only one dependency trail showing either a or b and i'd like to see
>> both trails.  I don't really need this info from the dependency trail
>> specifically, just want some way to get the whole graph with no loss
>> in relationships.
>>
>> Any ideas?
>>
>> -David
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>


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


Re: Tree/graph of Artifact objects

Posted by Carlos Sanchez <ca...@apache.org>.
if you want something graphical take a look at
http://code.google.com/p/maven-dependency-browser/

it's going to be integrated in Q4E
http://code.google.com/p/q4e/issues/detail?id=144


On Jan 18, 2008 12:15 PM, David Blevins <da...@visi.com> wrote:
> Is there any way to get or make a tree of Artifact objects?
>
> I've tried taking the list of Artifacts returned from
> project.getArtifacts(), then wrapping them in my own "node" object and
> relinking them via the info in the dependency trail.  This works fine
> except that there is some information loss.  Say two artifacts (a and
> b) each depend on a thrid artifact (c).  The "c" dependency will have
> only one dependency trail showing either a or b and i'd like to see
> both trails.  I don't really need this info from the dependency trail
> specifically, just want some way to get the whole graph with no loss
> in relationships.
>
> Any ideas?
>
> -David
>
>
>
> ---------------------------------------------------------------------
> 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: Tree/graph of Artifact objects

Posted by Mark Hobson <ma...@gmail.com>.
On 23/01/2008, David Blevins <da...@visi.com> wrote:
> So far the tree seems to have enough data in it that it can be
> rewrapped as a graph.  I have wrapper similar to DependencyNode that
> has multiple parents.  Anywhere a child is a "duplicate" or "conflict"
> it's replaced by the wrapper of the related artifact and a new parent
> added to the list.
>
> Relatively straight forward.  I could add it back into the maven-
> dependency-tree lib if you think it's particularly useful.

It could be a useful addition, but would rather see it done as an
option supplied to the tree builder as opposed to rewrapping the
nodes.  Perhaps raise an issue against maven-dependency-tree to add
this feature sometime in future.

Mark

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


Re: Tree/graph of Artifact objects

Posted by David Blevins <da...@visi.com>.
On Jan 22, 2008, at 6:49 AM, Mark Hobson wrote:

> Hi David,
>
> On 19/01/2008, David Blevins <da...@visi.com> wrote:
>> Still digging through that code, but hopefully you can answer this
>> question real quick.  The resulting structure is definitely a tree as
>> opposed to a graph (which could be fine).  Does that mean given the A
>> and B depend on C scenario I described, there'll be two copies of C;
>> one C below A with A as it's parentNode, and one C below B with B as
>> it's parent node?
>>
>> If the answer is yes, then I can easily re-arrange things to a graph
>> (multi-parent nodes).  If no, then can you confirm my suspicion  
>> that I
>> could achieve what I'm after with a slightly varied version of
>> DependencyTreeResolutionListener?
>
> maven-dependency-tree does indeed build a tree as opposed to a graph.
> You could implement a ResolutionListener that built a graph instead
> and ignored all the omit events, but if you ultimately also require
> the dependency resolutions from Maven then I'd advise adding optional
> graph functionality to maven-dependency-tree, since the resolution
> events are rather delicate (see DependencyTreeResolutionListener).
>
> Note that Jason is coordinating a lot of future work in this direction
> for 2.1, which will use graphs natively to resolve dependencies rather
> than events.

So far the tree seems to have enough data in it that it can be  
rewrapped as a graph.  I have wrapper similar to DependencyNode that  
has multiple parents.  Anywhere a child is a "duplicate" or "conflict"  
it's replaced by the wrapper of the related artifact and a new parent  
added to the list.

Relatively straight forward.  I could add it back into the maven- 
dependency-tree lib if you think it's particularly useful.

-David



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


Re: Tree/graph of Artifact objects

Posted by Mark Hobson <ma...@gmail.com>.
Hi David,

On 19/01/2008, David Blevins <da...@visi.com> wrote:
> Still digging through that code, but hopefully you can answer this
> question real quick.  The resulting structure is definitely a tree as
> opposed to a graph (which could be fine).  Does that mean given the A
> and B depend on C scenario I described, there'll be two copies of C;
> one C below A with A as it's parentNode, and one C below B with B as
> it's parent node?
>
> If the answer is yes, then I can easily re-arrange things to a graph
> (multi-parent nodes).  If no, then can you confirm my suspicion that I
> could achieve what I'm after with a slightly varied version of
> DependencyTreeResolutionListener?

maven-dependency-tree does indeed build a tree as opposed to a graph.
You could implement a ResolutionListener that built a graph instead
and ignored all the omit events, but if you ultimately also require
the dependency resolutions from Maven then I'd advise adding optional
graph functionality to maven-dependency-tree, since the resolution
events are rather delicate (see DependencyTreeResolutionListener).

Note that Jason is coordinating a lot of future work in this direction
for 2.1, which will use graphs natively to resolve dependencies rather
than events.

Cheers,

Mark

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


Re: Tree/graph of Artifact objects

Posted by David Blevins <da...@visi.com>.
On Jan 18, 2008, at 12:32 PM, Brian E. Fox wrote:

> -----Original Message-----
> From: David Blevins [mailto:david.blevins@visi.com]
>> Is there any way to get or make a tree of Artifact objects?
>>
>> I've tried taking the list of Artifacts returned from
>> project.getArtifacts(), then wrapping them in my own "node" object  
>> and
>> relinking them via the info in the dependency trail.  This works fine
>> except that there is some information loss.  Say two artifacts (a and
>> b) each depend on a thrid artifact (c).  The "c" dependency will have
>> only one dependency trail showing either a or b and i'd like to see
>> both trails.  I don't really need this info from the dependency trail
>> specifically, just want some way to get the whole graph with no loss
>> in relationships.
>
> Dependency:tree
>
> Or programmatically use the maven-dependency-tree jar.

Still digging through that code, but hopefully you can answer this  
question real quick.  The resulting structure is definitely a tree as  
opposed to a graph (which could be fine).  Does that mean given the A  
and B depend on C scenario I described, there'll be two copies of C;  
one C below A with A as it's parentNode, and one C below B with B as  
it's parent node?

If the answer is yes, then I can easily re-arrange things to a graph  
(multi-parent nodes).  If no, then can you confirm my suspicion that I  
could achieve what I'm after with a slightly varied version of  
DependencyTreeResolutionListener?

Thanks!

-David


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


RE: Tree/graph of Artifact objects

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Dependency:tree

Or programmatically use the maven-dependency-tree jar.

-----Original Message-----
From: David Blevins [mailto:david.blevins@visi.com] 
Sent: Friday, January 18, 2008 3:16 PM
To: Maven Developers List
Subject: Tree/graph of Artifact objects

Is there any way to get or make a tree of Artifact objects?

I've tried taking the list of Artifacts returned from  
project.getArtifacts(), then wrapping them in my own "node" object and  
relinking them via the info in the dependency trail.  This works fine  
except that there is some information loss.  Say two artifacts (a and  
b) each depend on a thrid artifact (c).  The "c" dependency will have  
only one dependency trail showing either a or b and i'd like to see  
both trails.  I don't really need this info from the dependency trail  
specifically, just want some way to get the whole graph with no loss  
in relationships.

Any ideas?

-David



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


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