maven-m2-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/project DefaultProjectDefaultsInjector.java ProjectDefaultsInjector.java
Date Wed, 02 Feb 2005 22:13:15 GMT
jdcasey     2005/02/02 14:13:15

  Modified:    maven-core/src/main/java/org/apache/maven/project
                        DefaultProjectDefaultsInjector.java
                        ProjectDefaultsInjector.java
  Log:
  o Removed dependency validation after default injection, since this is the job of the validator
(later in the project-building process)
  o Reformatted using m2 eclipse formatting file.
  
  Revision  Changes    Path
  1.4       +28 -36    maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDefaultsInjector.java
  
  Index: DefaultProjectDefaultsInjector.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultProjectDefaultsInjector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DefaultProjectDefaultsInjector.java	2 Feb 2005 02:23:12 -0000	1.3
  +++ DefaultProjectDefaultsInjector.java	2 Feb 2005 22:13:15 -0000	1.4
  @@ -12,72 +12,64 @@
   import org.codehaus.plexus.util.StringUtils;
   
   /**
  - * @author jdcasey
  - *
  - * Created on Feb 1, 2005
  + * @author jdcasey Created on Feb 1, 2005
    */
  -public class DefaultProjectDefaultsInjector implements ProjectDefaultsInjector
  +public class DefaultProjectDefaultsInjector
  +    implements ProjectDefaultsInjector
   {
  -    
  -    public void injectDefaults(MavenProject project)
  +
  +    public void injectDefaults( MavenProject project )
       {
  -        injectDependencyDefaults(project.getDependencies(), project.getDependencyManagement());
  +        injectDependencyDefaults( project.getDependencies(), project.getDependencyManagement()
);
       }
   
  -    /** Added: Feb 1, 2005 by jdcasey
  +    /**
  +     * Added: Feb 1, 2005 by jdcasey
        */
       private void injectDependencyDefaults( List dependencies, DependencyManagement dependencyManagement
)
       {
  -        if(dependencyManagement != null)
  +        if ( dependencyManagement != null )
           {
  -            // a given project's dependencies should be smaller than the group-defined
defaults set...
  -            // in other words, the project's deps will probably be a subset of those specified
in defaults.
  +            // a given project's dependencies should be smaller than the
  +            // group-defined defaults set...
  +            // in other words, the project's deps will probably be a subset of
  +            // those specified in defaults.
               Map depsMap = new TreeMap();
               for ( Iterator it = dependencies.iterator(); it.hasNext(); )
               {
                   Dependency dep = (Dependency) it.next();
  -                depsMap.put(dep.getManagementKey(), dep);
  +                depsMap.put( dep.getManagementKey(), dep );
               }
  -            
  +
               List dependencyDefaults = dependencyManagement.getDependencies();
  -            
  +
               for ( Iterator it = dependencyDefaults.iterator(); it.hasNext(); )
               {
                   Dependency def = (Dependency) it.next();
                   String key = def.getManagementKey();
  -                
  -                Dependency dep = (Dependency) depsMap.get(key);
  -                if(dep != null)
  +
  +                Dependency dep = (Dependency) depsMap.get( key );
  +                if ( dep != null )
                   {
  -                    mergeWithDefaults(dep, def);
  -                    validateDependency(dep);
  +                    mergeWithDefaults( dep, def );
                   }
               }
           }
       }
   
  -    /** Added: Feb 1, 2005 by jdcasey
  +    /**
  +     * Added: Feb 1, 2005 by jdcasey
        */
       private void mergeWithDefaults( Dependency dep, Dependency def )
       {
  -        if(dep.getVersion() == null && def.getVersion() != null)
  +        if ( dep.getVersion() == null && def.getVersion() != null )
           {
  -            dep.setVersion(def.getVersion());
  +            dep.setVersion( def.getVersion() );
           }
  -        
  -        Properties props = new Properties(def.getProperties());
  -        props.putAll(dep.getProperties());
  -        dep.setProperties(props);
  -    }
   
  -    /** Added: Feb 1, 2005 by jdcasey
  -     */
  -    private void validateDependency( Dependency dep )
  -    {
  -        if(StringUtils.isEmpty(dep.getVersion()))
  -        {
  -            throw new IllegalStateException("Dependency version is null for: " + dep.getId());
  -        }
  +        Properties props = new Properties( def.getProperties() );
  +        props.putAll( dep.getProperties() );
  +        dep.setProperties( props );
       }
   
  -}
  +}
  \ No newline at end of file
  
  
  
  1.3       +1 -3      maven-components/maven-core/src/main/java/org/apache/maven/project/ProjectDefaultsInjector.java
  
  Index: ProjectDefaultsInjector.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/ProjectDefaultsInjector.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ProjectDefaultsInjector.java	2 Feb 2005 20:15:28 -0000	1.2
  +++ ProjectDefaultsInjector.java	2 Feb 2005 22:13:15 -0000	1.3
  @@ -2,9 +2,7 @@
   package org.apache.maven.project;
   
   /**
  - * @author jdcasey
  - *
  - * Created on Feb 1, 2005
  + * @author jdcasey Created on Feb 1, 2005
    */
   public interface ProjectDefaultsInjector
   {
  
  
  

Mime
View raw message