You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by "Kevin Brown (JIRA)" <ji...@codehaus.org> on 2005/06/18 01:11:58 UTC

[jira] Created: (MNG-485) maven tool or swich to print dependency tree

maven tool or swich to print dependency tree
--------------------------------------------

         Key: MNG-485
         URL: http://jira.codehaus.org/browse/MNG-485
     Project: Maven 2
        Type: Wish
    Versions: 2.0-alpha-2    
    Reporter: Kevin Brown


I'm finding it incredibly difficult to find missing dependencies (lots of grepping of my local repository)  given the current m2 output.  In the case below, I am attempting to build jaxen 1.1-beta-6, and it appears that jaxen-1.1-beta-4.pom is being included somewhere!  This is after fixing up the XOM pom and the dom4j pom (both already listed as issues in Maven Evangelism on Jira)

I think a maven option m2 --print-dependency-tree would be incredibly helpful.  I would like to be able to see graphically any (and all) cycles or missing dependencies rather than the 1-at-a-time errors I am getting now.   I may build a stand-alone prototype and post it here.

$m2 install

[INFO] -------------------------------------------------------------------------
---
[INFO] Building jaxen
[INFO] -------------------------------------------------------------------------
---
[INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local repository
[INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local reposi
tory
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local reposit
ory
[INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local reposit
ory
[INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local reposito
ry
[INFO] [resources:resources]
Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
-4.pom
6K downloaded
Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
-4.pom.md5
0K downloaded
Downloading: http://repo1.maven.org/maven2/stax/stax-api/1.1-dev/stax-api-1.1-de
v.pom
[WARNING] Unable to get resource from repository http://repo1.maven.org/maven2
[INFO] -------------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO] -------------------------------------------------------------------------
---
[INFO] Main Error:
  Unable to download the artifact from any repository
  stax:stax-api:1.1-dev:pom

from the specified remote repositories:
  http://repo1.maven.org/maven2

Root error:
  Unable to download the artifact from any repository
[INFO] -------------------------------------------------------------------------
---
[INFO] Total time: 5 seconds
[INFO] Finished at: Fri Jun 17 18:59:25 EDT 2005
[INFO] Final Memory: 1M/2M
[INFO] -------------------------------------------------------------------------
---















-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Closed: (MNG-485) maven tool or swich to print dependency tree

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-485?page=all ]
     
Brett Porter closed MNG-485:
----------------------------

    Resolution: Fixed

nifty script there.

This is fixed in the code:
- errors show the path to the dependency from the project
- -X will show a full report on the resolution progress
- verbose="true" for the ant dependencies task

> maven tool or swich to print dependency tree
> --------------------------------------------
>
>          Key: MNG-485
>          URL: http://jira.codehaus.org/browse/MNG-485
>      Project: Maven 2
>         Type: Wish
>     Versions: 2.0-alpha-2
>     Reporter: Kevin Brown
>     Assignee: Brett Porter
>      Fix For: 2.0-alpha-3

>
>
> I'm finding it incredibly difficult to find missing dependencies (lots of grepping of my local repository)  given the current m2 output.  In the case below, I am attempting to build jaxen 1.1-beta-6, and it appears that jaxen-1.1-beta-4.pom is being included somewhere!  This is after fixing up the XOM pom and the dom4j pom (both already listed as issues in Maven Evangelism on Jira)
> I think a maven option m2 --print-dependency-tree would be incredibly helpful.  I would like to be able to see graphically any (and all) cycles or missing dependencies rather than the 1-at-a-time errors I am getting now.   I may build a stand-alone prototype and post it here.
> $m2 install
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Building jaxen
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local repository
> [INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local reposi
> tory
> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local reposit
> ory
> [INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local reposit
> ory
> [INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local reposito
> ry
> [INFO] [resources:resources]
> Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
> -4.pom
> 6K downloaded
> Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
> -4.pom.md5
> 0K downloaded
> Downloading: http://repo1.maven.org/maven2/stax/stax-api/1.1-dev/stax-api-1.1-de
> v.pom
> [WARNING] Unable to get resource from repository http://repo1.maven.org/maven2
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] BUILD FAILURE
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Main Error:
>   Unable to download the artifact from any repository
>   stax:stax-api:1.1-dev:pom
> from the specified remote repositories:
>   http://repo1.maven.org/maven2
> Root error:
>   Unable to download the artifact from any repository
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Total time: 5 seconds
> [INFO] Finished at: Fri Jun 17 18:59:25 EDT 2005
> [INFO] Final Memory: 1M/2M
> [INFO] -------------------------------------------------------------------------
> ---

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Updated: (MNG-485) maven tool or swich to print dependency tree

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MNG-485?page=all ]

Brett Porter updated MNG-485:
-----------------------------

      Assign To: Brett Porter
    Fix Version: 2.0-alpha-3

it is intended the rewrite for dependency mediation will improve on this, but I will keep this open to confirm

> maven tool or swich to print dependency tree
> --------------------------------------------
>
>          Key: MNG-485
>          URL: http://jira.codehaus.org/browse/MNG-485
>      Project: Maven 2
>         Type: Wish
>     Versions: 2.0-alpha-2
>     Reporter: Kevin Brown
>     Assignee: Brett Porter
>      Fix For: 2.0-alpha-3

>
>
> I'm finding it incredibly difficult to find missing dependencies (lots of grepping of my local repository)  given the current m2 output.  In the case below, I am attempting to build jaxen 1.1-beta-6, and it appears that jaxen-1.1-beta-4.pom is being included somewhere!  This is after fixing up the XOM pom and the dom4j pom (both already listed as issues in Maven Evangelism on Jira)
> I think a maven option m2 --print-dependency-tree would be incredibly helpful.  I would like to be able to see graphically any (and all) cycles or missing dependencies rather than the 1-at-a-time errors I am getting now.   I may build a stand-alone prototype and post it here.
> $m2 install
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Building jaxen
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local repository
> [INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local reposi
> tory
> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local reposit
> ory
> [INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local reposit
> ory
> [INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local reposito
> ry
> [INFO] [resources:resources]
> Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
> -4.pom
> 6K downloaded
> Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
> -4.pom.md5
> 0K downloaded
> Downloading: http://repo1.maven.org/maven2/stax/stax-api/1.1-dev/stax-api-1.1-de
> v.pom
> [WARNING] Unable to get resource from repository http://repo1.maven.org/maven2
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] BUILD FAILURE
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Main Error:
>   Unable to download the artifact from any repository
>   stax:stax-api:1.1-dev:pom
> from the specified remote repositories:
>   http://repo1.maven.org/maven2
> Root error:
>   Unable to download the artifact from any repository
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Total time: 5 seconds
> [INFO] Finished at: Fri Jun 17 18:59:25 EDT 2005
> [INFO] Final Memory: 1M/2M
> [INFO] -------------------------------------------------------------------------
> ---

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (MNG-485) maven tool or swich to print dependency tree

Posted by "Kevin Brown (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MNG-485?page=comments#action_41814 ] 

Kevin Brown commented on MNG-485:
---------------------------------

Potentially handy python script to genererate visual representation of dependency tree (on ibiblio and/or local repo) is below:

output (for dom4j):

kbrown@flick maven2 $ python m2-dep.py dom4j dom4j 1.6.1
-- ('dom4j', 'dom4j', '1.6.1')
  -- ('jaxme', 'jaxme-api', '0.3')
  -- ('jaxen', 'jaxen', '1.1-beta-6')
    -- ('dom4j', 'dom4j', '1.5.2')
      -- ('jaxme', 'jaxme-api', '0.3') (*dup*)
      -- ('jaxen', 'jaxen', '1.1-beta-4')
        -- ('dom4j', 'dom4j', '1.5.2') (*dup*)
        -- ('jdom', 'jdom', 'b10')
        -- ('xerces', 'xmlParserAPIs', '2.6.2')
        -- ('xerces', 'xercesImpl', '2.6.2')
        -- ('xom', 'xom', '1.0b3')
          -- ('xerces', 'xmlParserAPIs', '2.6.1')
PARSE ERROR OR POM NOT FOUND: mismatched tag: line 30, column 2
          -- ('xerces', 'xercesImpl', '2.2.1')
PARSE ERROR OR POM NOT FOUND: mismatched tag: line 30, column 2
          -- ('icu4j', 'icu4j', '2.6.1')
PARSE ERROR OR POM NOT FOUND: mismatched tag: line 30, column 2
          -- ('xalan', 'xalan', '2.6.0')
          -- ('tagsoup', 'tagsoup', '0.9.7')
PARSE ERROR OR POM NOT FOUND: mismatched tag: line 30, column 2
          -- ('servletapi', 'servlet', '2.4')
PARSE ERROR OR POM NOT FOUND: mismatched tag: line 30, column 2
      -- ('msv', 'xsdlib', '20030807')
      -- ('msv', 'relaxngDatatype', '20030807')
      -- ('pull-parser', 'pull-parser', '2')
      -- ('xpp3', 'xpp3', '1.1.3.3')
      -- ('stax', 'stax-api', '1.0')
      -- ('xml-apis', 'xml-apis', '2.0.2')
      -- ('junitperf', 'junitperf', '1.8')
      -- ('stax', 'stax', '1.1-dev')
        -- ('xmlbeans', 'xmlbeans-jsr173-api', '2.0-dev')
        -- ('junit', 'junit', '3.8.1')
      -- ('xerces', 'xercesImpl', '2.6.2') (*dup*)
      -- ('xalan', 'xalan', '2.5.1')
    -- ('jdom', 'jdom', '1.0')
    -- ('xerces', 'xmlParserAPIs', '2.6.2') (*dup*)
    -- ('xerces', 'xercesImpl', '2.6.2') (*dup*)
    -- ('xom', 'xom', '1.0b3') (*dup*)
  -- ('msv', 'xsdlib', '20030807') (*dup*)
  -- ('msv', 'relaxngDatatype', '20030807') (*dup*)
  -- ('pull-parser', 'pull-parser', '2') (*dup*)
  -- ('xpp3', 'xpp3', '1.1.3.3') (*dup*)
  -- ('stax', 'stax-api', '1.0') (*dup*)
  -- ('xml-apis', 'xml-apis', '2.0.2') (*dup*)
  -- ('junitperf', 'junitperf', '1.8') (*dup*)
  -- ('stax', 'stax', '1.1-dev') (*dup*)
  -- ('xerces', 'xercesImpl', '2.6.2') (*dup*)
  -- ('xalan', 'xalan', '2.5.1') (*dup*)

code (requires ElementTree python library):

#!/usr/bin/python
#author: kevin brown
#revision: 06-21-2005
from elementtree import ElementTree
import xml.parsers.expat
from urllib import urlopen
from string import Template
import sys

LOCAL_REPOSITORY='file:///home/kbrown/maven2/m2/repository'
REMOTE_REPOSITORY='http://www.ibiblio.org/maven2'

def constructPomUrl(repository, groupId, artifactId, version):
    s = Template('${repository}/${groupId}/${artifactId}/${version}/${artifactId}-${version}.pom')
    return s.substitute(repository=repository, groupId=groupId,artifactId=artifactId,version=version)

deps = []

#TODO: return tag with location found (remote/local)
def getTree(groupId, artifactId, version):
    global LOCAL_REPOSITORY
    global REMOTE_REPOSITORY
    tree=None
    if(0): #Optionally enable local repository
        try:
            filename=constructPomUrl(LOCAL_REPOSITORY,groupId, artifactId, version)
            #TODO: check for file existance
            tree=ElementTree.parse(urlopen(filename))
        except IOError, (errno, strerror):
                pass #suppress error - no big deal if not in local repository
            #print "Not found in local repository: I/O error (%s): %s " % (errno, strerror) 
        except xml.parsers.expat.ExpatError, message:
            pass #suppress error - no big deal if not in local repository
            #suppress error - no big deal if not in local repository
            #print "Not found in local repository: PARSE ERROR OR POM NOT FOUND: %s" %(message,) 
        
    if (not tree):
        try:    pass #suppress error - no big deal if not in local repository
        
            filename=constructPomUrl(REMOTE_REPOSITORY, groupId, artifactId, version)
            tree=ElementTree.parse(urlopen(filename))
        except IOError, (errno, strerror):
            print "I/O error (%s): %s " % (errno, strerror) 
        except xml.parsers.expat.ExpatError, message:
            print "PARSE ERROR OR POM NOT FOUND: %s" % (message,) 
    return tree 


def findDeps(groupId, artifactId, version, currentDepth=0):

    global deps
    if (currentDepth>10): #infinite recursion prevention #TODO: configurable default
        print "  "*currentDepth +"-- MEX DEPTH REACHED --"
        return

    artifact = (groupId, artifactId, version)
    s= "  "*currentDepth +"-- " + str(artifact)
    
    if (artifact in deps): 
        print s + " (*dup*)" #Note: if we built tree we could know if this were a cycle
        return

    deps.append(artifact)
    print s

    tree=getTree(groupId, artifactId, version)
    if (tree):
        for x in tree.findall('dependencies/dependency'):
            t=(x.find('groupId').text, x.find('artifactId').text, x.find('version').text)
            a,b,c=t
            findDeps(a,b,c,currentDepth+1) 
    # else shouldalready have had error message printed
    

            
#TODO: getopt - specify repote local repos
if (len(sys.argv) is not 4):
    print "USAGE:" 
    print sys.argv[0] + ' groupId artifactId version'
else:
    findDeps(sys.argv[1],sys.argv[2],sys.argv[3])









> maven tool or swich to print dependency tree
> --------------------------------------------
>
>          Key: MNG-485
>          URL: http://jira.codehaus.org/browse/MNG-485
>      Project: Maven 2
>         Type: Wish
>     Versions: 2.0-alpha-2
>     Reporter: Kevin Brown
>     Assignee: Brett Porter
>      Fix For: 2.0-alpha-3

>
>
> I'm finding it incredibly difficult to find missing dependencies (lots of grepping of my local repository)  given the current m2 output.  In the case below, I am attempting to build jaxen 1.1-beta-6, and it appears that jaxen-1.1-beta-4.pom is being included somewhere!  This is after fixing up the XOM pom and the dom4j pom (both already listed as issues in Maven Evangelism on Jira)
> I think a maven option m2 --print-dependency-tree would be incredibly helpful.  I would like to be able to see graphically any (and all) cycles or missing dependencies rather than the 1-at-a-time errors I am getting now.   I may build a stand-alone prototype and post it here.
> $m2 install
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Building jaxen
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local repository
> [INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local reposi
> tory
> [INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local reposit
> ory
> [INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local reposit
> ory
> [INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local reposito
> ry
> [INFO] [resources:resources]
> Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
> -4.pom
> 6K downloaded
> Downloading: http://repo1.maven.org/maven2/jaxen/jaxen/1.1-beta-4/jaxen-1.1-beta
> -4.pom.md5
> 0K downloaded
> Downloading: http://repo1.maven.org/maven2/stax/stax-api/1.1-dev/stax-api-1.1-de
> v.pom
> [WARNING] Unable to get resource from repository http://repo1.maven.org/maven2
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] BUILD FAILURE
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Main Error:
>   Unable to download the artifact from any repository
>   stax:stax-api:1.1-dev:pom
> from the specified remote repositories:
>   http://repo1.maven.org/maven2
> Root error:
>   Unable to download the artifact from any repository
> [INFO] -------------------------------------------------------------------------
> ---
> [INFO] Total time: 5 seconds
> [INFO] Finished at: Fri Jun 17 18:59:25 EDT 2005
> [INFO] Final Memory: 1M/2M
> [INFO] -------------------------------------------------------------------------
> ---

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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