maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: maven-components/maven-mboot2/src/main/java/model ModelReader.java
Date Tue, 05 Apr 2005 05:28:27 GMT
brett       2005/04/04 22:28:27

  Modified:    maven-mboot2/src/main/java/model ModelReader.java
  Log:
  better dep handling in mboot
  
  Revision  Changes    Path
  1.6       +25 -6     maven-components/maven-mboot2/src/main/java/model/ModelReader.java
  
  Index: ModelReader.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/model/ModelReader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ModelReader.java	4 Apr 2005 14:35:06 -0000	1.5
  +++ ModelReader.java	5 Apr 2005 05:28:26 -0000	1.6
  @@ -92,6 +92,8 @@
   
       private Map transitiveDependencies = new HashMap();
   
  +    private boolean insideDependencyManagement = false;
  +
       public ModelReader( ArtifactDownloader downloader, boolean resolveTransitiveDependencies
)
       {
           this.downloader = downloader;
  @@ -132,9 +134,16 @@
           }
           else if ( rawName.equals( "dependency" ) )
           {
  -            currentDependency = new Dependency();
  +            if ( !insideDependencyManagement )
  +            {
  +                currentDependency = new Dependency();
   
  -            insideDependency = true;
  +                insideDependency = true;
  +            }
  +        }
  +        else if ( rawName.equals( "dependencyManagement" ) )
  +        {
  +            insideDependencyManagement = true;
           }
           else if ( rawName.equals( "resource" ) )
           {
  @@ -195,7 +204,7 @@
               // actually, these should be transtive (see MNG-77) - but some projects have
circular deps that way (marmalade, and currently m2)
               ModelReader p = retrievePom( parentGroupId, parentArtifactId, parentVersion,
false );
   
  -            addDependencies( p.getDependencies(), parentDependencies );
  +            addDependencies( p.getDependencies(), parentDependencies, null );
   
               resources.addAll( p.getResources() );
   
  @@ -212,11 +221,15 @@
                       ModelReader p = retrievePom( currentDependency.getGroupId(), currentDependency.getArtifactId(),
                                                    currentDependency.getVersion(), resolveTransitiveDependencies
);
   
  -                    addDependencies( p.getDependencies(), transitiveDependencies );
  +                    addDependencies( p.getDependencies(), transitiveDependencies, currentDependency.getScope()
);
                   }
               }
               dependencies.put( currentDependency.getConflictId(), currentDependency );
           }
  +        else if ( rawName.equals( "dependencyManagement" ) )
  +        {
  +            insideDependencyManagement = false;
  +        }
           else if ( rawName.equals( "resource" ) )
           {
               resources.add( currentResource );
  @@ -332,12 +345,18 @@
           depth--;
       }
   
  -    private void addDependencies( Collection dependencies, Map target )
  +    private void addDependencies( Collection dependencies, Map target, String inheritedScope
)
       {
           for ( Iterator i = dependencies.iterator(); i.hasNext(); )
           {
               Dependency d = (Dependency) i.next();
   
  +            // Do we care about runtime here?
  +            if ( "test".equals( inheritedScope ) )
  +            {
  +                d.setScope( "test" );
  +            }
  +
               if ( !hasDependency( d, target ) )
               {
                   target.put( d.getConflictId(), d );
  
  
  

Mime
View raw message