incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r537380 - in /incubator/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/plugins/parser/m2/
Date Sat, 12 May 2007 10:37:27 GMT
Author: xavier
Date: Sat May 12 03:37:26 2007
New Revision: 537380

URL: http://svn.apache.org/viewvc?view=rev&rev=537380
Log:
FIX: packaging data not parsed in maven 2 pom (IVY-500) (thanks to Jeffrey Blatttman)

Added:
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-packaging.pom
  (with props)
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=537380&r1=537379&r2=537380
==============================================================================
--- incubator/ivy/core/trunk/CHANGES.txt (original)
+++ incubator/ivy/core/trunk/CHANGES.txt Sat May 12 03:37:26 2007
@@ -51,6 +51,7 @@
 
 - IMPROVEMENT: Allow "main" parameters to be passed directly (instead of using -args flag)
(IVY-480) (thanks to Archie Cobbs)
 
+- FIX: packaging data not parsed in maven 2 pom (IVY-500) (thanks to Jeffrey Blatttman)
 - FIX: install ant task: requires default resolver in ivy settings (IVY-477)
 - FIX: Ant project reference lost from context on multiple ant calls in single thread (IVY-497)
(thanks to Jaroslaw Wypychowski)
 - FIX: EOL in the doc pages (IVY-470)

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=537380&r1=537379&r2=537380
==============================================================================
--- 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 May 12 03:37:26 2007
@@ -85,6 +85,8 @@
         private String _revision;
         private String _scope;
         private String _classifier;
+        private String _type;
+        private String _ext;
         private boolean _optional = false;
         private List _exclusions = new ArrayList();
         private DefaultDependencyDescriptor _dd;
@@ -138,7 +140,10 @@
             _properties.put("project.version", _revision);
             _properties.put("pom.version", _revision);
             _md.setModuleRevisionId(mrid);
-            _md.addArtifact("master", new DefaultArtifact(mrid, getDefaultPubDate(),_module,
"jar", "jar"));
+            if (_type == null) {
+                _type = _ext = "jar";
+            }
+            _md.addArtifact("master", new DefaultArtifact(mrid, getDefaultPubDate(),_module,
_type, _ext));
             _organisation = null;
             _module = null;
             _revision = null;
@@ -177,7 +182,7 @@
                     	_dd.addDependencyArtifact(
                     			confs[i], 
                     			new DefaultDependencyArtifactDescriptor(
-                    					_dd.getDependencyId().getName(), 
+                    					_dd.getDependencyId().getName(),
                     					"jar", 
                     					"jar", // here we have to assume a type and ext for the artifact,
so this is a limitation compared to how m2 behave with classifiers
                     					null,
@@ -232,6 +237,11 @@
             	_revision = txt;
                 return;
             }
+            if (context.equals("project/parent/packaging") && _type == null) {
+            	_type = txt;
+	        _ext = txt;
+                return;
+            }
             if (context.startsWith("project/parent")) {
                 return;
             }
@@ -247,6 +257,9 @@
                     _revision = txt;
                 } else if (_revision == null && context.endsWith("version")) {
                     _revision = txt;
+                } else if (_type == null && context.endsWith("packaging")) {
+                    _type = txt;
+                    _ext = txt;
                 } else if (_scope == null && context.endsWith("scope")) {
                     _scope = txt;
                 } else if (_classifier == null && context.endsWith("dependency/classifier"))
{

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=537380&r1=537379&r2=537380
==============================================================================
--- 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 May 12 03:37:26 2007
@@ -58,6 +58,26 @@
         assertEquals(1, artifact.length);
         assertEquals(mrid, artifact[0].getModuleRevisionId());
         assertEquals("test", artifact[0].getName());
+        assertEquals("jar", artifact[0].getExt());
+        assertEquals("jar", artifact[0].getType());
+    }
+    
+    public void testPackaging() throws Exception {
+        ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor(new
IvySettings(), getClass().getResource("test-packaging.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());
+        assertEquals("war", artifact[0].getExt());
+        assertEquals("war", artifact[0].getType());
     }
     
     public void testParent() throws Exception {

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-packaging.pom
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-packaging.pom?view=auto&rev=537380
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-packaging.pom
(added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-packaging.pom
Sat May 12 03:37:26 2007
@@ -0,0 +1,32 @@
+<?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>
+  <packaging>war</packaging>
+  <name>Test Module for Ivy M2 parsing</name>
+  <version>1.0</version>
+  <url>http://ivy.jayasoft.org/</url>
+  <organization>
+    <name>Jayasoft</name>
+    <url>http://www.jayasoft.org/</url>
+  </organization>
+</project>

Propchange: incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-packaging.pom
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message