Author: xavier
Date: Sat Mar 17 03:05:03 2007
New Revision: 519276

URL: http://svn.apache.org/viewvc?view=rev&rev=519276
Log:
FIX: Invalid pom parsing when version is only declared in parent (IVY-436)

Added:
    
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/wicket-1.3-incubating-SNAPSHOT.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?view=diff&rev=519276&r1=519275&r2=519276
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Sat Mar 17 03:05:03 2007
@@ -19,6 +19,7 @@
 - FIX: ivy.revision property not set correctly for second resolve (IVY-429)
 - FIX: NPE when no organisation or no name is provided in module element of 
ivyconf (IVY-422)
 - FIX: FileUtil#copy(File src, File dest, CopyProgressListener l, boolean 
overwrite) (IVY-420)
+- FIX: Invalid pom parsing when version is only declared in parent (IVY-436)
 - FIX: ${project.groupId} and ${project.version} not processed correctly in 
poms (IVY-425)
 - FIX: Incorrect pom parsing with profile (IVY-423)
 - FIX: Ivy doesn't recognize maven2 classifiers (IVY-418)

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?view=diff&rev=519276&r1=519275&r2=519276
==============================================================================
--- 
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
 Sat Mar 17 03:05:03 2007
@@ -114,7 +114,8 @@
                 }
             } else if (_md.getModuleRevisionId() == null) {
                if ("project/dependencies".equals(context)
-                               || "project/profiles".equals(context)) {
+                               || "project/profiles".equals(context)
+                               || "project/build".equals(context)) {
                        fillMrid();
                }
             }
@@ -234,6 +235,10 @@
                _organisation = txt;
                 return;
             }
+            if (context.equals("project/parent/version") && _revision == null) 
{
+               _revision = txt;
+                return;
+            }
             if (context.startsWith("project/parent")) {
                 return;
             }
@@ -245,6 +250,8 @@
                        _organisation = txt;
                 } else if (_module == null && context.endsWith("artifactId")) {
                     _module = txt;
+                } else if (context.equals("project/version") || (_revision == 
null && context.endsWith("version"))) {
+                    _revision = txt;
                 } else if (_revision == null && context.endsWith("version")) {
                     _revision = txt;
                 } else if (_scope == null && context.endsWith("scope")) {

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?view=diff&rev=519276&r1=519275&r2=519276
==============================================================================
--- 
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
 Sat Mar 17 03:05:03 2007
@@ -169,6 +169,13 @@
         assertEquals(ModuleRevisionId.newInstance("junit", "junit", "3.7"), 
dds[0].getDependencyRevisionId());
     }
     
+    public void testReal2() throws Exception {
+        ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), 
getClass().getResource("wicket-1.3-incubating-SNAPSHOT.pom"), false);
+        assertNotNull(md);
+        
+        assertEquals(ModuleRevisionId.newInstance("org.apache.wicket", 
"wicket", "1.3-incubating-SNAPSHOT"), md.getModuleRevisionId());
+    }
+    
     public void testVariables() throws Exception {
        // test case for IVY-425
         ModuleDescriptor md = 
PomModuleDescriptorParser.getInstance().parseDescriptor(new IvySettings(), 
getClass().getResource("spring-hibernate3-2.0.2.pom"), false);

Added: 
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/wicket-1.3-incubating-SNAPSHOT.pom
URL: 
http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/wicket-1.3-incubating-SNAPSHOT.pom?view=auto&rev=519276
==============================================================================
--- 
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/wicket-1.3-incubating-SNAPSHOT.pom
 (added)
+++ 
incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/wicket-1.3-incubating-SNAPSHOT.pom
 Sat Mar 17 03:05:03 2007
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   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 xmlns="http://maven.apache.org/POM/4.0.0";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>org.apache.wicket</groupId>
+               <artifactId>wicket-parent</artifactId>
+               <version>1.3-incubating-SNAPSHOT</version>
+               <relativePath>../wicket-parent</relativePath>
+       </parent>
+
+       <artifactId>wicket</artifactId>
+       <packaging>jar</packaging>
+       <name>Wicket</name>
+       <url>http://wicketframework.org/${project.artifactId}-1.3</url>
+       <description>Wicket is a Java web application framework that takes 
simplicity, separation of concerns and ease of development to a whole new 
level. Wicket pages can be mocked up, previewed and later revised using 
standard WYSIWYG HTML design tools. Dynamic content processing and form 
handling is all handled in Java code using a first-class component model backed 
by POJO data beans that can easily be persisted using your favorite 
technology.</description>
+
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <configuration>
+                                       <source>1.4</source>
+                                       <target>1.4</target>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               
<artifactId>surefire-report-maven-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-surefire-plugin</artifactId>
+                               <version>2.1.3</version>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-javadoc-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-source-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-assembly-plugin</artifactId>
+                       </plugin>
+               </plugins>
+       </build>
+       <reporting>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               
<artifactId>maven-project-info-reports-plugin</artifactId>
+                               <reportSets>
+                                       <reportSet>
+                                               <reports>
+                                                       
<report>dependencies</report>
+                                                       
<report>project-team</report>
+                                                       
<report>mailing-list</report>
+                                                       
<report>issue-tracking</report>
+                                                       <report>license</report>
+                                                       <report>scm</report>
+                                               </reports>
+                                       </reportSet>
+                               </reportSets>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-javadoc-plugin</artifactId>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               
<artifactId>surefire-report-maven-plugin</artifactId>
+                       </plugin>
+               </plugins>
+       </reporting>
+</project>


Reply via email to