Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 72520 invoked from network); 26 Sep 2008 20:16:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Sep 2008 20:16:31 -0000 Received: (qmail 72753 invoked by uid 500); 26 Sep 2008 20:16:29 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 72700 invoked by uid 500); 26 Sep 2008 20:16:29 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 72691 invoked by uid 99); 26 Sep 2008 20:16:29 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2008 13:16:29 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2008 20:15:36 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D493F238889E; Fri, 26 Sep 2008 13:16:10 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r699482 - in /ant/ivy/core/trunk: CHANGES.txt src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorBuilder.java src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Date: Fri, 26 Sep 2008 20:16:10 -0000 To: notifications@ant.apache.org From: maartenc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080926201610.D493F238889E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: maartenc Date: Fri Sep 26 13:16:10 2008 New Revision: 699482 URL: http://svn.apache.org/viewvc?rev=699482&view=rev Log: FIX: Maven packaging of "pom" should add a "jar" artifact if present (IVY-920) 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/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Modified: ant/ivy/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=699482&r1=699481&r2=699482&view=diff ============================================================================== --- ant/ivy/core/trunk/CHANGES.txt (original) +++ ant/ivy/core/trunk/CHANGES.txt Fri Sep 26 13:16:10 2008 @@ -88,6 +88,7 @@ - FIX: Ivy can't handle bare POM ${groupId} property (IVY-913) (thanks to Tom Widmer) - FIX: Properties needed to parse version in POM (IVY-914) (thanks to Tom Widmer) - FIX: build.xml: checkstyle + checkstyle-report dont work together (IVY-919) +- FIX: Maven packaging of "pom" should add a "jar" artifact if present (IVY-920) 2.0.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=699482&r1=699481&r2=699482&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 Fri Sep 26 13:16:10 2008 @@ -31,6 +31,7 @@ import java.util.Map.Entry; import org.apache.ivy.Ivy; +import org.apache.ivy.core.cache.ArtifactOrigin; import org.apache.ivy.core.module.descriptor.Artifact; import org.apache.ivy.core.module.descriptor.Configuration; import org.apache.ivy.core.module.descriptor.DefaultArtifact; @@ -50,8 +51,10 @@ import org.apache.ivy.plugins.matcher.ExactPatternMatcher; import org.apache.ivy.plugins.matcher.PatternMatcher; import org.apache.ivy.plugins.parser.ModuleDescriptorParser; +import org.apache.ivy.plugins.parser.ParserSettings; import org.apache.ivy.plugins.parser.m2.PomReader.PomDependencyData; import org.apache.ivy.plugins.repository.Resource; +import org.apache.ivy.plugins.resolver.DependencyResolver; import org.apache.ivy.util.Message; @@ -187,9 +190,11 @@ private ModuleRevisionId mrid; private DefaultArtifact mainArtifact; + + private ParserSettings parserSettings; - public PomModuleDescriptorBuilder(ModuleDescriptorParser parser, Resource res) { + public PomModuleDescriptorBuilder(ModuleDescriptorParser parser, Resource res, ParserSettings ivySettings) { ivyModuleDescriptor = new DefaultModuleDescriptor(parser, res); ivyModuleDescriptor.setResolvedPublicationDate(new Date(res.getLastModified())); for (int i = 0; i < MAVEN2_CONFIGURATIONS.length; i++) { @@ -197,6 +202,7 @@ } ivyModuleDescriptor.setMappingOverride(true); ivyModuleDescriptor.addExtraAttributeNamespace("m", Ivy.getIvyHomeURL() + "maven"); + parserSettings = ivySettings; } @@ -232,7 +238,19 @@ * cover all cases. */ if ("pom".equals(packaging)) { - // no artifact defined! + // no artifact defined! Add the default artifact if it exist. + DependencyResolver resolver = parserSettings.getResolver(mrid); + + if (resolver != null) { + DefaultArtifact artifact = new DefaultArtifact(mrid, new Date(), artifactId, "jar", "jar"); + ArtifactOrigin artifactOrigin = resolver.locate(artifact); + + if (!ArtifactOrigin.isUnknown(artifactOrigin)) { + mainArtifact = artifact; + ivyModuleDescriptor.addArtifact("master", mainArtifact); + } + } + return; } else if (JAR_PACKAGINGS.contains(packaging)) { ext = "jar"; Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java?rev=699482&r1=699481&r2=699482&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java Fri Sep 26 13:16:10 2008 @@ -108,7 +108,7 @@ public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL descriptorURL, Resource res, boolean validate) throws ParseException, IOException { - PomModuleDescriptorBuilder mdBuilder = new PomModuleDescriptorBuilder(this, res); + PomModuleDescriptorBuilder mdBuilder = new PomModuleDescriptorBuilder(this, res, ivySettings); try { PomReader domReader = new PomReader(descriptorURL, res);