Author: maartenc Date: Tue Aug 5 14:45:49 2008 New Revision: 682974 URL: http://svn.apache.org/viewvc?rev=682974&view=rev Log: FIX: Maven2 "ejb" packaging is not supported (IVY-873)
Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-packaging.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=682974&r1=682973&r2=682974&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Tue Aug 5 14:45:49 2008 @@ -101,6 +101,7 @@ - IMPROVEMENT: Smarter determination if an expression is exact or not for RegexpPatternMatcher and GlobPatternMatcher - IMPROVEMENT: Check branch consistency during resolve (IVY-858) +- FIX: Maven2 "ejb" packaging is not supported (IVY-873) - FIX: Config files with # in path can't be read (IVY-868) (thanks to Simon Steiner) - FIX: Cache can't distinguish artifacts with classifiers (IVY-803) (thanks to James P. White) - FIX: Reports showing double dependencies in certain cases (IVY-578) 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=682974&r1=682973&r2=682974&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 Tue Aug 5 14:45:49 2008 @@ -213,7 +213,15 @@ public void addArtifact(String artifactId, String packaging) { - String ext = packaging; + String ext; + if ("pom".equals(packaging)) { + // no artifact defined! + return; + } else if ("ejb".equals(packaging)) { + ext = "jar"; + } else { + ext = packaging; + } // TODO: we should refactor the following code into something more configurable @@ -231,7 +239,7 @@ } ivyModuleDescriptor.addArtifact("master", - new DefaultArtifact(mrid, new Date(), artifactId, ext, ext)); + new DefaultArtifact(mrid, new Date(), artifactId, packaging, ext)); } 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=682974&r1=682973&r2=682974&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 Tue Aug 5 14:45:49 2008 @@ -121,6 +121,22 @@ assertEquals("war", artifact[0].getType()); } + public void testEjbPackaging() throws Exception { + ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor( + settings, getClass().getResource("test-ejb-packaging.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()); + assertEquals("jar", artifact[0].getExt()); + assertEquals("ejb", artifact[0].getType()); + } + public void testParent() throws Exception { ModuleDescriptor md = PomModuleDescriptorParser.getInstance().parseDescriptor( Added: ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-packaging.pom URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-packaging.pom?rev=682974&view=auto ============================================================================== --- ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-packaging.pom (added) +++ ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/parser/m2/test-ejb-packaging.pom Tue Aug 5 14:45:49 2008 @@ -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>ejb</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>