cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/artifact MavenMetadataSource.java

2005-04-07 Thread jdcasey
jdcasey 2005/04/07 18:57:06

  Modified:maven-core-it integration-tests.txt README.txt
   maven-core/src/main/java/org/apache/maven/artifact
MavenMetadataSource.java
  Added:   maven-core-it/it0018 goals.txt pom.xml expected-results.txt
.cvsignore
  Log:
  Added new IT to express the problems with caching the model before 
interpolation takes place.
  
  Rolled back the changes to suppress usage of the cached model in 
MavenMetadataSource. Restored original functionality, to pre- last revision.
  
  Revision  ChangesPath
  1.1  maven-components/maven-core-it/it0018/goals.txt
  
  Index: goals.txt
  ===
  package
  
  
  
  1.1  maven-components/maven-core-it/it0018/pom.xml
  
  Index: pom.xml
  ===
  
4.0.0
org.apache.maven
maven-core-it0018
1.0


  
marmalade
marmalade-el-commons
1.0-alpha-2
  

  
  
  
  
  
  1.1  
maven-components/maven-core-it/it0018/expected-results.txt
  
  Index: expected-results.txt
  ===
  target/classes/org/apache/maven/it0018/Person.class
  
  
  
  1.1  maven-components/maven-core-it/it0018/.cvsignore
  
  Index: .cvsignore
  ===
  *~
  *.log
  target
  *.ipr
  *.iws
  dist
  target
  .classpath
  .project
  log.txt
  
  
  
  1.23  +1 -0  maven-components/maven-core-it/integration-tests.txt
  
  Index: integration-tests.txt
  ===
  RCS file: /home/cvs/maven-components/maven-core-it/integration-tests.txt,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- integration-tests.txt 22 Mar 2005 06:40:08 -  1.22
  +++ integration-tests.txt 8 Apr 2005 01:57:06 -   1.23
  @@ -14,3 +14,4 @@
   it0015
   it0016
   it0017
  +it0018
  \ No newline at end of file
  
  
  
  1.24  +3 -0  maven-components/maven-core-it/README.txt
  
  Index: README.txt
  ===
  RCS file: /home/cvs/maven-components/maven-core-it/README.txt,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- README.txt22 Mar 2005 06:40:08 -  1.23
  +++ README.txt8 Apr 2005 01:57:06 -   1.24
  @@ -52,6 +52,9 @@
   it0016: Test a WAR generation
   
   it0017: Test an EJB generation
  +
  +it0018: Ensure that managed dependencies for dependency POMs are calculated
  +correctly when resolved.
   
---
   
   - generated sources
  
  
  
  1.28  +10 -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.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- MavenMetadataSource.java  7 Apr 2005 21:52:17 -   1.27
  +++ MavenMetadataSource.java  8 Apr 2005 01:57:06 -   1.28
  @@ -87,15 +87,15 @@
   // 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 ( mavenProjectBuilder != null )
  +{
  +Model model = mavenProjectBuilder.getCachedModel( 
artifact.getGroupId(), artifact.getArtifactId(),
  +  
artifact.getVersion() );
  +if ( model != null )
  +{
  +dependencies = model.getDependencies();
  +}
  +}
   
   if ( dependencies == null )
   {
  
  
  


cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/artifact MavenMetadataSource.java

2005-04-07 Thread jdcasey
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  ChangesPath
  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 -   1.62
  +++ DefaultMavenProjectBuilder.java   7 Apr 2005 21:52:17 -   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 -   1.26
  +++ MavenMetadataSource.java  7 Apr 2005 21:52:17 -   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(

cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/artifact MavenMetadataSource.java

2005-04-06 Thread brett
brett   2005/04/06 00:38:14

  Modified:maven-core/src/main/java/org/apache/maven/artifact
MavenMetadataSource.java
  Log:
  get the base version, not the resolved version
  
  Revision  ChangesPath
  1.26  +2 -2  
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.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- MavenMetadataSource.java  29 Mar 2005 16:41:13 -  1.25
  +++ MavenMetadataSource.java  6 Apr 2005 07:38:14 -   1.26
  @@ -87,7 +87,7 @@
   {
   Artifact metadataArtifact = artifactFactory.createArtifact( 
artifact.getGroupId(),
   
artifact.getArtifactId(),
  -
artifact.getVersion(), artifact.getScope(),
  +
artifact.getBaseVersion(), artifact.getScope(),
   
"pom", null );
   
   try