You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by ma...@apache.org on 2007/10/10 21:22:05 UTC

svn commit: r583619 - in /incubator/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/plugins/parser/m2/

Author: maartenc
Date: Wed Oct 10 14:22:05 2007
New Revision: 583619

URL: http://svn.apache.org/viewvc?rev=583619&view=rev
Log:
FIX: ${parent.version} property is not recognized in maven2 pom (IVY-620)

Added:
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent.version.pom
Modified:
    incubator/ivy/core/trunk/CHANGES.txt
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java

Modified: incubator/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/CHANGES.txt?rev=583619&r1=583618&r2=583619&view=diff
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Wed Oct 10 14:22:05 2007
@@ -52,6 +52,7 @@
 
    version in SVN
 =====================================
+- FIX: ${parent.version} property is not recognized in maven2 pom (IVY-620)
 - FIX: Ivy doesn't work with Ant 1.6.2 (IVY-614)
 - FIX: EmptyStackException when upgrading from 1.4 to 2.0 (IVY-610)
 - FIX: Ivy:retrieve fails through proxy server (IVY-529)

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=583619&r1=583618&r2=583619&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Wed Oct 10 14:22:05 2007
@@ -221,6 +221,8 @@
             String context = getContext();
             if (md.getModuleRevisionId() == null && ("project".equals(context))) {
                 fillMrid();
+            } else if ("project/parent/version".equals(context)) {
+                properties.put("parent.version", revision);
             } else if (((organisation != null && module != null && revision != null) || dd != null)
                     && "project/dependencies/dependency".equals(context)) {
                 if (dd == null) {

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java?rev=583619&r1=583618&r2=583619&view=diff
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java Wed Oct 10 14:22:05 2007
@@ -118,6 +118,24 @@
         assertEquals("test", artifact[0].getName());
     }
 
+    public void testParentVersion() throws Exception {
+        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
+            new IvySettings(), getClass().getResource("test-parent.version.pom"), false);
+        assertNotNull(md);
+
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
+        assertEquals(mrid, md.getModuleRevisionId());
+
+        assertNotNull(md.getConfigurations());
+        assertEquals(Arrays.asList(PomModuleDescriptorParser.MAVEN2_CONFIGURATIONS), Arrays
+                .asList(md.getConfigurations()));
+
+        Artifact[] artifact = md.getArtifacts("master");
+        assertEquals(1, artifact.length);
+        assertEquals(mrid, artifact[0].getModuleRevisionId());
+        assertEquals("test", artifact[0].getName());
+    }
+
     public void testDependencies() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             new IvySettings(), getClass().getResource("test-dependencies.pom"), false);

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent.version.pom
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent.version.pom?rev=583619&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent.version.pom (added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-parent.version.pom Wed Oct 10 14:22:05 2007
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you 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.    
+-->
+<project>
+  <parent>
+    <artifactId>test-parent</artifactId>
+    <groupId>org.apache</groupId>
+    <version>1.0</version>
+  </parent>
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>test</artifactId>
+  <name>Test Module for Ivy M2 parsing</name>
+  <version>${parent.version}</version>
+  <url>http://ivy.jayasoft.org/</url>
+  <organization>
+    <name>Jayasoft</name>
+    <url>http://www.jayasoft.org/</url>
+  </organization>
+</project>