You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ma...@apache.org on 2009/04/15 23:27:18 UTC

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

Author: maartenc
Date: Wed Apr 15 21:27:17 2009
New Revision: 765366

URL: http://svn.apache.org/viewvc?rev=765366&view=rev
Log:
FIX: PomModuleDescriptorBuilder does not resolve ejb type dependencies to jar extension (IVY-1058) (thanks to Andrey Lomakin)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-type.pom
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParserTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=765366&r1=765365&r2=765366&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Wed Apr 15 21:27:17 2009
@@ -49,6 +49,7 @@
 	Tat Leung
 	Costin Leau
 	Antoine Levy-Lambert
+	Andrey Lomakin
 	William Lyvers
 	Sakari Maaranen
 	Jan Materne
@@ -86,7 +87,8 @@
 	
    trunk
 =====================================
-- FIX: Wrong BuildException messages (findmodules) (IVY-1056)   
+- FIX: Wrong BuildException messages (findmodules) (IVY-1056)
+- FIX: PomModuleDescriptorBuilder does not resolve ejb type dependencies to jar extension (IVY-1058) (thanks to Andrey Lomakin)   
 	
    2.1.0-rc1
 =====================================

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java?rev=765366&r1=765365&r2=765366&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java Wed Apr 15 21:27:17 2009
@@ -292,6 +292,10 @@
             if (dep.getType() != null) {
                 type = dep.getType();
             }
+            String ext = type;
+            if (JAR_PACKAGINGS.contains(type)) {
+                ext = "jar";
+            }
             // we deal with classifiers by setting an extra attribute and forcing the
             // dependency to assume such an artifact is published
             if (dep.getClassifier() != null) {
@@ -299,7 +303,7 @@
             }
             DefaultDependencyArtifactDescriptor depArtifact = 
                     new DefaultDependencyArtifactDescriptor(dd, dd.getDependencyId().getName(),
-                        type, type, null, extraAtt);
+                        type, ext, null, extraAtt);
             // here we have to assume a type and ext for the artifact, so this is a limitation
             // compared to how m2 behave with classifiers
             String optionalizedScope = dep.isOptional() ? "optional" : scope;

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=765366&r1=765365&r2=765366&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 Wed Apr 15 21:27:17 2009
@@ -27,6 +27,7 @@
 
 import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.descriptor.DependencyArtifactDescriptor;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ExcludeRule;
 import org.apache.ivy.core.module.descriptor.License;
@@ -148,6 +149,26 @@
         assertEquals("ejb", artifact[0].getType());
     }
 
+    public void testEjbType() throws Exception {
+        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
+            settings, getClass().getResource("test-ejb-type.pom"), false);
+        assertNotNull(md);
+
+        ModuleRevisionId mrid = ModuleRevisionId.newInstance("org.apache", "test", "1.0");
+        assertEquals(mrid, md.getModuleRevisionId());
+
+        DependencyDescriptor[] deps = md.getDependencies();
+        assertNotNull(deps);
+        assertEquals(1, deps.length);
+        
+        DependencyArtifactDescriptor[] artifacts = deps[0].getAllDependencyArtifacts();
+        assertNotNull(artifacts);
+        assertEquals(1, artifacts.length);
+        assertEquals("test", artifacts[0].getName());
+        assertEquals("jar", artifacts[0].getExt());
+        assertEquals("ejb", artifacts[0].getType());
+    }
+
     public void testParent() throws Exception {
         ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(
             settings, getClass().getResource("test-parent.pom"), false);

Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-type.pom
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-type.pom?rev=765366&view=auto
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-type.pom (added)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-type.pom Wed Apr 15 21:27:17 2009
@@ -0,0 +1,39 @@
+<?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>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache</groupId>
+  <artifactId>test</artifactId>
+  <name>Test Module for dependencies with type</name>
+  <version>1.0</version>
+  <url>http://ant.apache.org/ivy</url>
+  <organization>
+    <name>Apache</name>
+    <url>http://www.apache.org/</url>
+  </organization>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache</groupId>
+      <artifactId>test</artifactId>
+      <version>1.0</version>
+      <type>ejb</type>
+    </dependency>
+  </dependencies>
+</project>