Author: maartenc Date: Thu Oct 23 12:51:37 2008 New Revision: 707459 URL: http://svn.apache.org/viewvc?rev=707459&view=rev Log: FIX: Maven pom parser is not handling pom property ${project.parent.version} (IVY-955)
Added: ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/test-project.parent.version.pom Modified: ant/ivy/core/branches/2.0.0-rc2/CHANGES.txt ant/ivy/core/branches/2.0.0-rc2/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java Modified: ant/ivy/core/branches/2.0.0-rc2/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.0-rc2/CHANGES.txt?rev=707459&r1=707458&r2=707459&view=diff ============================================================================== --- ant/ivy/core/branches/2.0.0-rc2/CHANGES.txt (original) +++ ant/ivy/core/branches/2.0.0-rc2/CHANGES.txt Thu Oct 23 12:51:37 2008 @@ -117,6 +117,7 @@ - FIX: Maven pom license url can contain xml entities (IVY-950) - FIX: Maven pom license has name as optional element (IVY-949) - FIX: Ivy doesn't throw an error when the parent POM cannot be loaded (IVY-931) +- FIX: Maven pom parser is not handling pom property ${project.parent.version} (IVY-955) 2.0.0-rc1 ===================================== Modified: ant/ivy/core/branches/2.0.0-rc2/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.0-rc2/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=707459&r1=707458&r2=707459&view=diff ============================================================================== --- ant/ivy/core/branches/2.0.0-rc2/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original) +++ ant/ivy/core/branches/2.0.0-rc2/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Thu Oct 23 12:51:37 2008 @@ -114,6 +114,7 @@ try { PomReader domReader = new PomReader(descriptorURL, res); domReader.setProperty("parent.version", domReader.getParentVersion()); + domReader.setProperty("project.parent.version", domReader.getParentVersion()); Map pomProperties = domReader.getPomProperties(); for (Iterator iter = pomProperties.entrySet().iterator(); iter.hasNext();) { Modified: ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java?rev=707459&r1=707458&r2=707459&view=diff ============================================================================== --- ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java (original) +++ ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java Thu Oct 23 12:51:37 2008 @@ -190,6 +190,20 @@ assertEquals("test", artifact[0].getName()); } + public void testProjectParentVersion() throws Exception { + ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor( + settings, getClass().getResource("test-project.parent.version.pom"), false); + assertNotNull(md); + + ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0"); + assertEquals(mrid, md.getModuleRevisionId()); + + 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( settings, getClass().getResource("test-dependencies.pom"), false); Added: ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/test-project.parent.version.pom URL: http://svn.apache.org/viewvc/ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/test-project.parent.version.pom?rev=707459&view=auto ============================================================================== --- ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/test-project.parent.version.pom (added) +++ ant/ivy/core/branches/2.0.0-rc2/test/java/org/apache/ivy/plugins/parser/m2/test-project.parent.version.pom Thu Oct 23 12:51:37 2008 @@ -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>${project.parent.version}</version> + <url>http://ant.apache.org/ivy</url> + <organization> + <name>Apache</name> + <url>http://www.apache.org/</url> + </organization> +</project>