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/artifact MavenMetadataSource.java
Date Thu, 07 Apr 2005 21:52:17 GMT
jdcasey     2005/04/07 14:52:17

  Modified:    maven-core/src/main/java/org/apache/maven/project
                        DefaultMavenProjectBuilder.java
               maven-core/src/main/java/org/apache/maven/artifact
                        MavenMetadataSource.java
  Log:
  Commented out use of cached model in MavenMetadataSource, as this is causing problems with
projects that depend on other projects which use managed dependencies.
  
  Revision  Changes    Path
  1.63      +15 -3     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.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- DefaultMavenProjectBuilder.java	6 Apr 2005 01:28:29 -0000	1.62
  +++ DefaultMavenProjectBuilder.java	7 Apr 2005 21:52:17 -0000	1.63
  @@ -164,11 +164,23 @@
           throws ProjectBuildingException, ModelInterpolationException, ArtifactResolutionException
       {
           Model model = project.getModel();
  -        String key = createCacheKey( model.getGroupId(), model.getArtifactId(), model.getVersion()
);
  -        Model cachedModel = (Model) modelCache.get( key );
  +        
  +        String cacheKey = createCacheKey( model.getGroupId(), model.getArtifactId(), model.getVersion()
);
  +        
  +        // [jc] This needs to be moved below the interpolation and defaults
  +        // injection steps, especially since the interpolator returns a different
  +        // instance of the Model. HOWEVER, I cannot move this caching step to
  +        // the appropriate place, since it results in inconsistent artifact 
  +        // naming between the jar:jar and install:install steps for some reason.
  +        // 
  +        // So, instead I'm commenting out the part of the MavenMetadataSource
  +        // that looks up the cached model, and leaving this caching step right
  +        // here...at least until I have more time to look at why this cannot be
  +        // moved down.
  +        Model cachedModel = (Model) modelCache.get( cacheKey );
           if ( cachedModel == null || sourceProject )
           {
  -            modelCache.put( key, model );
  +            modelCache.put( cacheKey, model );
           }
   
           model = modelInterpolator.interpolate( model );
  
  
  
  1.27      +24 -10    maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java
  
  Index: MavenMetadataSource.java
  ===================================================================
  RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/artifact/MavenMetadataSource.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- MavenMetadataSource.java	6 Apr 2005 07:38:14 -0000	1.26
  +++ MavenMetadataSource.java	7 Apr 2005 21:52:17 -0000	1.27
  @@ -73,15 +73,29 @@
       {
           List dependencies = null;
   
  -        if ( mavenProjectBuilder != null )
  -        {
  -            Model model = mavenProjectBuilder.getCachedModel( artifact.getGroupId(), artifact.getArtifactId(),
  -                                                              artifact.getVersion() );
  -            if ( model != null )
  -            {
  -                dependencies = model.getDependencies();
  -            }
  -        }
  +        // [jc] Commenting this out, because the place where the model is 
  +        // cached in the project builder has not accounted for interpolation or
  +        // defaults injection. This wouldn't be a problem, except that the 
  +        // interpolation step actually returns a different instance of the 
  +        // model than was input, thus rendering the old version of the model
  +        // stale. To test this, you have to create an artifact whose pom uses
  +        // managed dependencies, then depend on that artifact from another
  +        // project. The first plugin to refer to this dependency will work fine, 
  +        // but subsequent plugins referring to the dep will retrieved a cached
  +        // copy of the model that has no versions, etc. defined because that
  +        // model instance has not had defaults injected or interpolations 
  +        // resolved. See note in DefaultMavenProjectBuilder, line 170 for 
  +        // further discussion.
  +        
  +//        if ( mavenProjectBuilder != null )
  +//        {
  +//            Model model = mavenProjectBuilder.getCachedModel( artifact.getGroupId(),
artifact.getArtifactId(),
  +//                                                              artifact.getVersion() );
  +//            if ( model != null )
  +//            {
  +//                dependencies = model.getDependencies();
  +//            }
  +//        }
   
           if ( dependencies == null )
           {
  
  
  

Mime
View raw message