ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gscok...@apache.org
Subject svn commit: r629215 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/plugins/parser/m2/ test/repositories/parentPom/org/apache/dm/parent/2.0/ test/repositories/paren...
Date Tue, 19 Feb 2008 20:22:54 GMT
Author: gscokart
Date: Tue Feb 19 12:22:51 2008
New Revision: 629215

URL: http://svn.apache.org/viewvc?rev=629215&view=rev
Log:
FIX: Inherit depedencies defined in parent pom (IVY-683)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
    ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/parent/2.0/parent-2.0.pom
    ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/test/1.0/test-1.0.pom

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=629215&r1=629214&r2=629215&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Tue Feb 19 12:22:51 2008
@@ -77,6 +77,7 @@
 - IMPROVEMENT: Decrease memory footprint (IVY-662)
 - IMPROVEMENT: Downgrade Ant version requirement to 1.6 to build Ivy (IVY-687)
 - IMPROVEMENT: In the ResolveReport class, add the possibility to filter the evicted module
while getting the list of DownloadArtifact (IVY-704) (thanks to Nicolas Lalevée)
+- IMPORVEMENT: Refactor the PomModuleDescriptorParser in order to allow easier integration
of maven pom 	 
 
 - FIX: ivy:install task not using validate attribute (IVY-728)
 - FIX: Bad conflict resolution leads to bad "configuration(s) not found" error (IVY-729)
@@ -98,6 +99,7 @@
 - FIX: Strict conflictmanager seems to not support dynamic revisions (IVY-474)
 - FIX: NPE in namespace transformation during the ivy:findrevision and ivy:resolve task execution
(IVY-659) (thanks to Andrea Bernardo Ciddio)
 - FIX: Maven test scope includes all runtime dependencies (IVY-682)
+- FIX: Inherit depedencies defined in parent pom (IVY-683)
 
 - TASK: Remove cache attribute on Ant tasks (IVY-685)
 
@@ -125,7 +127,6 @@
 - IMPROVEMENT: Improvements on hello ivy example (IVY-626) (with contribution from Jacob
Grydholt Jensen)
 - IMPROVEMENT: Make the root attribute in the ivyrep resolver mandatory (IVY-625)
 - IMPROVEMENT: New text representation for main module metadata concepts (IVY-649)
-- IMPORVEMENT: Refactor the PomModuleDescriptorParser in order to allow easier integration
of maven pom
 
 - FIX: m2 incompatibility - IVY does not recognize property section (IVY-637)
 - FIX: m2 incompatibility - IVY does not recognize parent pom (IVY-636)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=629215&r1=629214&r2=629215&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
Tue Feb 19 12:22:51 2008
@@ -159,9 +159,18 @@
                 domReader.setProperty("pom.version", version);
                 domReader.setProperty("version", version);
 
+                ModuleDescriptor parentDescr = null;
                 if (domReader.hasParent()) {
                     domReader.setProperty("parent.version", domReader.getParentVersion());
                     //Is there any other parent properties?
+                    
+                    ModuleRevisionId parentModRevID = ModuleRevisionId.newInstance(
+                        domReader.getParentGroupId(), 
+                        domReader.getParentArtifactId(), 
+                        domReader.getParentVersion());
+                    ResolvedModuleRevision parentModule = parseOtherPom(ivySettings, 
+                        parentModRevID);
+                    parentDescr = parentModule.getDescriptor();
                 }
                 
                 for (Iterator it = domReader.getDependencyMgt().iterator(); it.hasNext();)
{
@@ -169,24 +178,21 @@
                     mdBuilder.addDependencyMgt(dep);
                 }
                 
-                if (domReader.hasParent()) {
-                    ModuleRevisionId parentModRevID = ModuleRevisionId.newInstance(
-                        domReader.getParentGroupId(), 
-                        domReader.getParentArtifactId(), 
-                        domReader.getParentVersion());
-                    ResolvedModuleRevision parentModule = parseOtherPom(ivySettings, 
-                        parentModRevID);
-                    ModuleDescriptor parentDescr = parentModule.getDescriptor();
+                if (parentDescr != null) {
                     mdBuilder.addExtraDescription(parentDescr.getExtraInfo());
-                    for (int i = 0; i < parentDescr.getDependencies().length; i++) {
-                        mdBuilder.addDependency(parentDescr.getDependencies()[i]);
-                    }
-                }                
-                
+                }
+
                 for (Iterator it = domReader.getDependencies().iterator(); it.hasNext();)
{
                     PomReader.PomDependencyData dep = (PomReader.PomDependencyData) it.next();
                     mdBuilder.addDependency(res, dep);
                 }
+
+                if (parentDescr != null) {
+                    for (int i = 0; i < parentDescr.getDependencies().length; i++) {
+                        mdBuilder.addDependency(parentDescr.getDependencies()[i]);
+                    }
+                }
+                
                 mdBuilder.addArtifact(artifactId , domReader.getPackaging());
             }            
         } catch (SAXException e) {

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=629215&r1=629214&r2=629215&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Tue Feb 19 12:22:51
2008
@@ -3396,8 +3396,8 @@
         // test has a dependency on test2 but there is no version listed. test has a parent
of parent(2.0) 
         // then parent2. Both parents have a dependencyManagement element for test2, and
each list the version as
         // ${pom.version}. The parent version should take precidence over parent2, 
-        // so the version should be test2 version 2.0. Test3 is also a dependency, and it's
version is listed
-        // as 1.0 in parent2.
+        // so the version should be test2 version 2.0. Test3 is also a dependency of parent,
and it's version is listed
+        // as 1.0 in parent2 (dependencies inherited from parent comes after).
         Ivy ivy = new Ivy();
         ivy.configure(new File("test/repositories/parentPom/ivysettings.xml"));
         ivy.getSettings().setDefaultResolver("parentChain");
@@ -3443,8 +3443,8 @@
         // test has a dependency on test2 but there is no version listed. test has a parent
of parent(2.0) 
         // then parent2. Both parents have a dependencyManagement element for test2, and
each list the version as
         // ${pom.version}. The parent version should take precidence over parent2, 
-        // so the version should be test2 version 2.0. Test3 is also a dependency, and it's
version is listed
-        // as 1.0 in parent2.
+        // so the version should be test2 version 2.0. Test3 is also a dependency of parent,
and it's version is listed
+        // as 1.0 in parent2. (dependencies inherited from parent comes after)
 
         // now run tests with dual resolver
         Ivy ivy = new Ivy();

Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java?rev=629215&r1=629214&r2=629215&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
Tue Feb 19 12:22:51 2008
@@ -503,9 +503,9 @@
         DependencyDescriptor[] dds = md.getDependencies();
         assertNotNull(dds);
         assertEquals(2, dds.length);
-        assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
-            dds[0].getDependencyRevisionId());
         assertEquals(ModuleRevisionId.newInstance("commons-collection", "commons-collection",
"1.0.5"),
+            dds[0].getDependencyRevisionId());
+        assertEquals(ModuleRevisionId.newInstance("commons-logging", "commons-logging", "1.0.4"),
             dds[1].getDependencyRevisionId());
     }
 }

Modified: ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/parent/2.0/parent-2.0.pom
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/parent/2.0/parent-2.0.pom?rev=629215&r1=629214&r2=629215&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/parent/2.0/parent-2.0.pom
(original)
+++ ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/parent/2.0/parent-2.0.pom
Tue Feb 19 12:22:51 2008
@@ -37,4 +37,11 @@
         </dependency>
     </dependencies>
   </dependencyManagement>
+   <dependencies>
+    <dependency>
+      <groupId>org.apache.dm</groupId>
+      <artifactId>test3</artifactId>
+    </dependency>
+  </dependencies>
+  
 </project>

Modified: ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/test/1.0/test-1.0.pom
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/test/1.0/test-1.0.pom?rev=629215&r1=629214&r2=629215&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/test/1.0/test-1.0.pom (original)
+++ ant/ivy/core/trunk/test/repositories/parentPom/org/apache/dm/test/1.0/test-1.0.pom Tue
Feb 19 12:22:51 2008
@@ -38,9 +38,5 @@
       <groupId>org.apache.dm</groupId>
       <artifactId>test2</artifactId>
     </dependency>
-    <dependency>
-      <groupId>org.apache.dm</groupId>
-      <artifactId>test3</artifactId>
-    </dependency>
   </dependencies>
 </project>



Mime
View raw message