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-core/src/test/java/org/apache/maven/project DefaultProjectDefaultsInjectorTest.java
Date Wed, 23 Feb 2005 03:27:00 GMT
brett       2005/02/22 19:27:00

  Modified:    maven-core/src/main/java/org/apache/maven/project/inheritance
                        DefaultModelInheritanceAssembler.java
               maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
               maven-core/src/main/resources/META-INF/plexus components.xml
               maven-core/src/main/resources/org/apache/maven/project
                        pom-4.0.0.xml
               maven-core/src/test/java/org/apache/maven/project/interpolation
                        RegexBasedProjectInterpolatorTest.java
               maven-core/src/test/java/org/apache/maven/project
                        DefaultProjectDefaultsInjectorTest.java
  Added:       maven-core/src/main/java/org/apache/maven/project/injection
                        DefaultModelDefaultsInjector.java
                        ModelDefaultsInjector.java
               maven-core/src/main/java/org/apache/maven/project/interpolation
                        ModelInterpolationException.java
                        ModelInterpolator.java
                        RegexBasedModelInterpolator.java
  Removed:     maven-core/src/main/java/org/apache/maven/project/injection
                        DefaultProjectDefaultsInjector.java
                        ProjectDefaultsInjector.java
               maven-core/src/main/java/org/apache/maven/project/interpolation
                        ProjectInterpolationException.java
                        ProjectInterpolator.java
                        RegexBasedProjectInterpolator.java
  Log:
  refactoring:
  - use an expression in the suport POM to set up finalName
  - have interpolator and injector deal only with model
  
  Revision  Changes    Path
  1.16      +5 -0      maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java
  
  Index: DefaultModelInheritanceAssembler.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/inheritance/DefaultModelInheritanceAssembler.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultModelInheritanceAssembler.java	2 Feb 2005 22:14:46 -0000	1.15
  +++ DefaultModelInheritanceAssembler.java	23 Feb 2005 03:26:59 -0000	1.16
  @@ -233,6 +233,11 @@
                   child.getBuild().setTestOutput( parent.getBuild().getTestOutput() );
               }
   
  +            if ( child.getBuild().getFinalName() == null )
  +            {
  +                child.getBuild().setFinalName( parent.getBuild().getFinalName() );
  +            }
  +
               List resources = child.getBuild().getResources();
               if ( resources == null || resources.isEmpty() )
               {
  
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/project/injection/DefaultModelDefaultsInjector.java
  
  Index: DefaultModelDefaultsInjector.java
  ===================================================================
  package org.apache.maven.project.injection;
  
  /*
   * Copyright 2001-2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.maven.model.Dependency;
  import org.apache.maven.model.DependencyManagement;
  import org.apache.maven.model.Model;
  
  import java.util.Iterator;
  import java.util.List;
  import java.util.Map;
  import java.util.Properties;
  import java.util.TreeMap;
  
  /**
   * @author jdcasey Created on Feb 1, 2005
   */
  public class DefaultModelDefaultsInjector
      implements ModelDefaultsInjector
  {
  
      public void injectDefaults( Model model )
      {
          injectDependencyDefaults( model.getDependencies(), model.getDependencyManagement()
);
      }
  
      /**
       * Added: Feb 1, 2005 by jdcasey
       */
      private void injectDependencyDefaults( List dependencies, DependencyManagement dependencyManagement
)
      {
          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.
              Map depsMap = new TreeMap();
              for ( Iterator it = dependencies.iterator(); it.hasNext(); )
              {
                  Dependency dep = (Dependency) it.next();
                  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 )
                  {
                      mergeWithDefaults( dep, def );
                  }
              }
          }
      }
  
      /**
       * Added: Feb 1, 2005 by jdcasey
       */
      private void mergeWithDefaults( Dependency dep, Dependency def )
      {
          if ( dep.getVersion() == null && def.getVersion() != null )
          {
              dep.setVersion( def.getVersion() );
          }
  
          Properties props = new Properties( def.getProperties() );
          props.putAll( dep.getProperties() );
          dep.setProperties( props );
      }
  
  }
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/project/injection/ModelDefaultsInjector.java
  
  Index: ModelDefaultsInjector.java
  ===================================================================
  package org.apache.maven.project.injection;
  
  /*
   * Copyright 2001-2005 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *      http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  import org.apache.maven.model.Model;
  
  /**
   * @author jdcasey Created on Feb 1, 2005
   */
  public interface ModelDefaultsInjector
  {
      String ROLE = ModelDefaultsInjector.class.getName();
  
      void injectDefaults( Model model );
  }
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/ModelInterpolationException.java
  
  Index: ModelInterpolationException.java
  ===================================================================
  package org.apache.maven.project.interpolation;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  /**
   * @author jdcasey
   *
   * Created on Feb 2, 2005
   */
  public class ModelInterpolationException
      extends Exception
  {
  
      /** Added: Feb 2, 2005 by jdcasey
       */
      public ModelInterpolationException( String expression, Throwable cause )
      {
          super( "The POM expression: " + expression + " could not be evaluated.", cause );
  
      }
  }
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/ModelInterpolator.java
  
  Index: ModelInterpolator.java
  ===================================================================
  package org.apache.maven.project.interpolation;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import org.apache.maven.model.Model;
  
  /**
   * @author jdcasey
   *
   * Created on Feb 2, 2005
   */
  public interface ModelInterpolator
  {
  
      String ROLE = ModelInterpolator.class.getName();
  
      Model interpolate( Model project ) throws ModelInterpolationException;
  
  }
  
  
  1.1                  maven-components/maven-core/src/main/java/org/apache/maven/project/interpolation/RegexBasedModelInterpolator.java
  
  Index: RegexBasedModelInterpolator.java
  ===================================================================
  package org.apache.maven.project.interpolation;
  
  /* ====================================================================
   *   Copyright 2001-2004 The Apache Software Foundation.
   *
   *   Licensed under the Apache License, Version 2.0 (the "License");
   *   you may not use this file except in compliance with the License.
   *   You may obtain a copy of the License at
   *
   *       http://www.apache.org/licenses/LICENSE-2.0
   *
   *   Unless required by applicable law or agreed to in writing, software
   *   distributed under the License is distributed on an "AS IS" BASIS,
   *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   *   See the License for the specific language governing permissions and
   *   limitations under the License.
   * ====================================================================
   */
  
  import org.apache.maven.model.Model;
  import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
  import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
  import org.apache.maven.util.introspection.ReflectionValueExtractor;
  import org.codehaus.plexus.logging.AbstractLogEnabled;
  import org.codehaus.plexus.logging.Logger;
  
  import java.io.StringReader;
  import java.io.StringWriter;
  import java.util.regex.Matcher;
  import java.util.regex.Pattern;
  
  /**
   * @author jdcasey Created on Feb 3, 2005
   */
  public class RegexBasedModelInterpolator
      extends AbstractLogEnabled
      implements ModelInterpolator
  {
  
      private static final Pattern EXPRESSION_PATTERN = Pattern.compile( "#([A-Za-z.]+)" );
  
      /**
       * Added: Feb 3, 2005 by jdcasey
       */
      public Model interpolate( Model model ) throws ModelInterpolationException
      {
          StringWriter sWriter = new StringWriter();
  
          MavenXpp3Writer writer = new MavenXpp3Writer();
          try
          {
              writer.write( sWriter, model );
          }
          catch( Exception e )
          {
              throw new ModelInterpolationException(
                  "Cannot serialize project model for interpolation.", e );
          }
  
          String serializedModel = sWriter.toString();
          serializedModel = interpolateInternal( serializedModel, model );
  
          StringReader sReader = new StringReader( serializedModel );
  
          MavenXpp3Reader modelReader = new MavenXpp3Reader();
          try
          {
              model = modelReader.read( sReader );
          }
          catch( Exception e )
          {
              throw new ModelInterpolationException(
                  "Cannot read project model from interpolating filter of serialized version.",
e );
          }
  
          return model;
      }
  
      /**
       * Added: Feb 3, 2005 by jdcasey
       */
      private String interpolateInternal( String src, Model model )
      {
          String result = src;
          Matcher matcher = EXPRESSION_PATTERN.matcher( result );
          while( matcher.find() )
          {
              String wholeExpr = matcher.group( 0 );
              String realExpr = matcher.group( 1 );
  
              String value = null;
              try
              {
                  value = String.valueOf( ReflectionValueExtractor.evaluate( realExpr, model
) );
              }
              catch( Exception e )
              {
                  Logger logger = getLogger();
                  if( logger != null )
                  {
                      logger.debug( "POM interpolation cannot proceed with expression: " +
wholeExpr
                          + ". Skipping...", e );
                  }
              }
  
              if( value != null )
              {
                  result = result.replaceAll( wholeExpr, value );
                  matcher.reset( result );
              }
          }
  
          return result;
      }
  
  }
  
  
  1.32      +12 -17    maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
  
  Index: DefaultMavenProjectBuilder.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- DefaultMavenProjectBuilder.java	23 Feb 2005 01:59:34 -0000	1.31
  +++ DefaultMavenProjectBuilder.java	23 Feb 2005 03:27:00 -0000	1.32
  @@ -31,8 +31,8 @@
   import org.apache.maven.model.Parent;
   import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
   import org.apache.maven.project.inheritance.ModelInheritanceAssembler;
  -import org.apache.maven.project.injection.ProjectDefaultsInjector;
  -import org.apache.maven.project.interpolation.ProjectInterpolator;
  +import org.apache.maven.project.injection.ModelDefaultsInjector;
  +import org.apache.maven.project.interpolation.ModelInterpolator;
   import org.apache.maven.project.path.PathTranslator;
   import org.apache.maven.project.validation.ModelValidationResult;
   import org.apache.maven.project.validation.ModelValidator;
  @@ -73,9 +73,9 @@
   
       private PathTranslator pathTranslator;
   
  -    private ProjectDefaultsInjector projectDefaultsInjector;
  +    private ModelDefaultsInjector modelDefaultsInjector;
   
  -    private ProjectInterpolator projectInterpolator;
  +    private ModelInterpolator modelInterpolator;
   
       public void initialize()
           throws Exception
  @@ -117,14 +117,17 @@
                   previous = current;
               }
   
  -            project = projectInterpolator.interpolate( project );
  +            Model model = modelInterpolator.interpolate( project.getModel() );
   
  -            projectDefaultsInjector.injectDefaults( project );
  +            // interpolation is before injection, because interpolation is off-limits in
the injected variables
  +            modelDefaultsInjector.injectDefaults( model );
   
  -            project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(),
localRepository ) );
  +            MavenProject parentProject = project.getParent();
   
  -            // @todo this should be in the super POM when interpolation works
  -            setupMavenFinalName( project );
  +            project = new MavenProject( model );
  +            project.setFile( projectDescriptor );
  +            project.setParent( parentProject );
  +            project.setArtifacts( artifactFactory.createArtifacts( project.getDependencies(),
localRepository ) );
   
               // ----------------------------------------------------------------------
               // Typically when the project builder is being used from maven proper
  @@ -220,14 +223,6 @@
           return project;
       }
   
  -    private void setupMavenFinalName( MavenProject project )
  -    {
  -        if ( project.getModel().getBuild().getFinalName() == null )
  -        {
  -            project.getModel().getBuild().setFinalName( project.getArtifactId() + "-" +
project.getVersion() );
  -        }
  -    }
  -
       private Model readModel( File projectDescriptor )
           throws ProjectBuildingException
       {
  
  
  
  1.13      +6 -6      maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml
  
  Index: components.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/META-INF/plexus/components.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- components.xml	23 Feb 2005 01:59:34 -0000	1.12
  +++ components.xml	23 Feb 2005 03:27:00 -0000	1.13
  @@ -77,8 +77,8 @@
        |
        -->
       <component>
  -      <role>org.apache.maven.project.interpolation.ProjectInterpolator</role>
  -      <implementation>org.apache.maven.project.interpolation.RegexBasedProjectInterpolator</implementation>
  +      <role>org.apache.maven.project.interpolation.ModelInterpolator</role>
  +      <implementation>org.apache.maven.project.interpolation.RegexBasedModelInterpolator</implementation>
       </component>
       <!--
        |
  @@ -86,8 +86,8 @@
        |
        -->
       <component>
  -      <role>org.apache.maven.project.injection.ProjectDefaultsInjector</role>
  -      <implementation>org.apache.maven.project.injection.DefaultProjectDefaultsInjector</implementation>
  +      <role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
  +      <implementation>org.apache.maven.project.injection.DefaultModelDefaultsInjector</implementation>
       </component>
       <!--
        |
  @@ -99,10 +99,10 @@
         <implementation>org.apache.maven.project.DefaultMavenProjectBuilder</implementation>
         <requirements>
           <requirement>
  -          <role>org.apache.maven.project.injection.ProjectDefaultsInjector</role>
  +          <role>org.apache.maven.project.injection.ModelDefaultsInjector</role>
           </requirement>
           <requirement>
  -          <role>org.apache.maven.project.interpolation.ProjectInterpolator</role>
  +          <role>org.apache.maven.project.interpolation.ModelInterpolator</role>
           </requirement>
           <requirement>
             <role>org.apache.maven.project.inheritance.ModelInheritanceAssembler</role>
  
  
  
  1.4       +1 -8      maven-components/maven-core/src/main/resources/org/apache/maven/project/pom-4.0.0.xml
  
  Index: pom-4.0.0.xml
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/resources/org/apache/maven/project/pom-4.0.0.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- pom-4.0.0.xml	5 Dec 2004 04:16:05 -0000	1.3
  +++ pom-4.0.0.xml	23 Feb 2005 03:27:00 -0000	1.4
  @@ -20,14 +20,6 @@
     </pluginRepositories>
   -->
   
  -  <!-- TODO: should be the maven local home -->
  -  <!-- TODO: substitution not working -->
  -<!--
  -  <local>
  -    <repository>${user.home}/.m2/repository</repository>
  -  </local>
  --->
  -
     <!-- Default plugins
     <plugins>
       <plugin>
  @@ -40,6 +32,7 @@
       <!-- This all may just fold into plugin parameters -->
       <directory>target</directory>
       <output>target/classes</output>
  +    <finalName>#artifactId-#version</finalName>
       <testOutput>target/test-classes</testOutput>
       <sourceDirectory>src/main/java</sourceDirectory>
       <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
  
  
  
  1.2       +4 -8      maven-components/maven-core/src/test/java/org/apache/maven/project/interpolation/RegexBasedProjectInterpolatorTest.java
  
  Index: RegexBasedProjectInterpolatorTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/interpolation/RegexBasedProjectInterpolatorTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RegexBasedProjectInterpolatorTest.java	3 Feb 2005 20:54:15 -0000	1.1
  +++ RegexBasedProjectInterpolatorTest.java	23 Feb 2005 03:27:00 -0000	1.2
  @@ -18,10 +18,8 @@
    */
   
   import junit.framework.TestCase;
  -
   import org.apache.maven.model.Dependency;
   import org.apache.maven.model.Model;
  -import org.apache.maven.project.MavenProject;
   
   /**
    * @author jdcasey
  @@ -33,7 +31,7 @@
   {
   
       public void testShouldInterpolateDependencyVersionToSetSameAsProjectVersion()
  -        throws ProjectInterpolationException
  +        throws ModelInterpolationException
       {
           Model model = new Model();
           model.setVersion( "3.8.1" );
  @@ -43,14 +41,13 @@
   
           model.addDependency( dep );
   
  -        MavenProject in = new MavenProject( model );
  -        MavenProject out = new RegexBasedProjectInterpolator().interpolate( in );
  +        Model out = new RegexBasedModelInterpolator().interpolate( model );
   
           assertEquals( "3.8.1", ((Dependency) out.getDependencies().get( 0 )).getVersion()
);
       }
   
       public void testShouldNotInterpolateDependencyVersionWithInvalidReference()
  -        throws ProjectInterpolationException
  +        throws ModelInterpolationException
       {
           Model model = new Model();
           model.setVersion( "3.8.1" );
  @@ -60,8 +57,7 @@
   
           model.addDependency( dep );
   
  -        MavenProject in = new MavenProject( model );
  -        MavenProject out = new RegexBasedProjectInterpolator().interpolate( in );
  +        Model out = new RegexBasedModelInterpolator().interpolate( model );
   
           assertEquals( "#something", ((Dependency) out.getDependencies().get( 0 )).getVersion()
);
       }
  
  
  
  1.5       +14 -26    maven-components/maven-core/src/test/java/org/apache/maven/project/DefaultProjectDefaultsInjectorTest.java
  
  Index: DefaultProjectDefaultsInjectorTest.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/test/java/org/apache/maven/project/DefaultProjectDefaultsInjectorTest.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultProjectDefaultsInjectorTest.java	23 Feb 2005 01:59:34 -0000	1.4
  +++ DefaultProjectDefaultsInjectorTest.java	23 Feb 2005 03:27:00 -0000	1.5
  @@ -20,7 +20,7 @@
   import org.apache.maven.model.Dependency;
   import org.apache.maven.model.DependencyManagement;
   import org.apache.maven.model.Model;
  -import org.apache.maven.project.injection.DefaultProjectDefaultsInjector;
  +import org.apache.maven.project.injection.DefaultModelDefaultsInjector;
   
   import java.util.List;
   import java.util.Properties;
  @@ -36,7 +36,7 @@
   
       public void testShouldConstructWithNoParams()
       {
  -        new DefaultProjectDefaultsInjector();
  +        new DefaultModelDefaultsInjector();
       }
   
       public void testShouldSucceedInMergingDependencyWithDependency()
  @@ -60,11 +60,9 @@
   
           model.setDependencyManagement( depMgmt );
   
  -        MavenProject project = new MavenProject( model );
  +        new DefaultModelDefaultsInjector().injectDefaults( model );
   
  -        new DefaultProjectDefaultsInjector().injectDefaults( project );
  -
  -        List deps = project.getDependencies();
  +        List deps = model.getDependencies();
           assertEquals( 1, deps.size() );
   
           Dependency result = (Dependency) deps.get( 0 );
  @@ -92,11 +90,9 @@
   
           model.setDependencyManagement( depMgmt );
   
  -        MavenProject project = new MavenProject( model );
  -
  -        new DefaultProjectDefaultsInjector().injectDefaults( project );
  +        new DefaultModelDefaultsInjector().injectDefaults( model );
   
  -        List deps = project.getDependencies();
  +        List deps = model.getDependencies();
           assertEquals( 1, deps.size() );
   
           Dependency result = (Dependency) deps.get( 0 );
  @@ -124,11 +120,9 @@
   
           model.setDependencyManagement( depMgmt );
   
  -        MavenProject project = new MavenProject( model );
  -
  -        new DefaultProjectDefaultsInjector().injectDefaults( project );
  +        new DefaultModelDefaultsInjector().injectDefaults( model );
   
  -        List deps = project.getDependencies();
  +        List deps = model.getDependencies();
           assertEquals( 1, deps.size() );
   
           Dependency result = (Dependency) deps.get( 0 );
  @@ -161,11 +155,9 @@
   
           model.setDependencyManagement( depMgmt );
   
  -        MavenProject project = new MavenProject( model );
  +        new DefaultModelDefaultsInjector().injectDefaults( model );
   
  -        new DefaultProjectDefaultsInjector().injectDefaults( project );
  -
  -        List deps = project.getDependencies();
  +        List deps = model.getDependencies();
           assertEquals( 1, deps.size() );
   
           Dependency result = (Dependency) deps.get( 0 );
  @@ -204,11 +196,9 @@
   
           model.setDependencyManagement( depMgmt );
   
  -        MavenProject project = new MavenProject( model );
  -
  -        new DefaultProjectDefaultsInjector().injectDefaults( project );
  +        new DefaultModelDefaultsInjector().injectDefaults( model );
   
  -        List deps = project.getDependencies();
  +        List deps = model.getDependencies();
           assertEquals( 1, deps.size() );
   
           Dependency result = (Dependency) deps.get( 0 );
  @@ -235,12 +225,10 @@
   
           model.setDependencyManagement( depMgmt );
   
  -        MavenProject project = new MavenProject( model );
  -
   //        try
   //        {
  -        new DefaultProjectDefaultsInjector().injectDefaults( project );
  -        Dependency dependency = (Dependency) project.getDependencies().get( 0 );
  +        new DefaultModelDefaultsInjector().injectDefaults( model );
  +        Dependency dependency = (Dependency) model.getDependencies().get( 0 );
           assertNull( "check version is null", dependency.getVersion() );
   //            fail("Should fail to validate dependency without a version.");
   //        }
  
  
  

Mime
View raw message