It will cause an extra HTTP HEAD request for modules that don't have an artifact with a 'sources' classifier.
Maarten ----- Original Message ---- From: Gilles Scokart <gscok...@gmail.com> To: dev@ant.apache.org Sent: Mon, November 2, 2009 8:46:19 AM Subject: Re: svn commit: r831776 - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/plugins/parser/m2/ test/java/org/apache/ivy/core/resolve/ test/repositories/m2/org/apache/test-src/ test/repositories/m2/org/apache/test-src/1.0/ What is the performance impact for this change? Gilles Scokart 2009/11/1 <maart...@apache.org> > Author: maartenc > Date: Sun Nov 1 22:57:30 2009 > New Revision: 831776 > > URL: http://svn.apache.org/viewvc?rev=831776&view=rev > Log: > IMPROVEMENT: discover 'src' sources in maven repos (IVY-1138) > > Added: > > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml > (with props) > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/ > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/ > > > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0-src.jar > (with props) > > > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.jar > (with props) > > > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.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/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java > > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java > > Modified: ant/ivy/core/trunk/CHANGES.txt > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=831776&r1=831775&r2=831776&view=diff > > ============================================================================== > --- ant/ivy/core/trunk/CHANGES.txt (original) > +++ ant/ivy/core/trunk/CHANGES.txt Sun Nov 1 22:57:30 2009 > @@ -94,6 +94,7 @@ > > trunk > ===================================== > +- IMPROVEMENT: discover 'src' sources in maven repos (IVY-1138) > - IMPROVEMENT: Trace a message when a property file referenced from the > settings doesn't exixts (IVY-1074) > - IMPROVEMENT: use defaultconf in combination with defaultconfmapping > (IVY-1135) (thanks to Jon Schneider) > > > 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=831776&r1=831775&r2=831776&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 > Sun Nov 1 22:57:30 2009 > @@ -597,6 +597,12 @@ > null, Collections.singletonMap("m:classifier", "sources")); > } > > + public Artifact getSrcArtifact() { > + return new MDArtifact( > + ivyModuleDescriptor, mrid.getName(), "source", "jar", > + null, Collections.singletonMap("m:classifier", "src")); > + } > + > public Artifact getJavadocArtifact() { > return new MDArtifact( > ivyModuleDescriptor, mrid.getName(), "javadoc", "jar", > @@ -607,6 +613,10 @@ > ivyModuleDescriptor.addArtifact("sources", getSourceArtifact()); > } > > + public void addSrcArtifact() { > + ivyModuleDescriptor.addArtifact("sources", getSrcArtifact()); > + } > + > public void addJavadocArtifact() { > ivyModuleDescriptor.addArtifact("javadoc", getJavadocArtifact()); > } > > 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=831776&r1=831775&r2=831776&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 > Sun Nov 1 22:57:30 2009 > @@ -283,7 +283,16 @@ > Message.debug("source artifact found for " + mrid); > mdBuilder.addSourceArtifact(); > } else { > - Message.debug("no source artifact found for " + mrid); > + // it seems that sometimes the 'src' classifier is > used instead of 'sources' > + // Cfr. IVY-1138 > + ArtifactOrigin srcArtifact = > resolver.locate(mdBuilder.getSrcArtifact()); > + if (!ArtifactOrigin.isUnknown(srcArtifact) > + && > !srcArtifact.getLocation().equals(mainArtifactLocation)) { > + Message.debug("source artifact found for " + > mrid); > + mdBuilder.addSrcArtifact(); > + } else { > + Message.debug("no source artifact found for " + > mrid); > + } > } > ArtifactOrigin javadocArtifact = > resolver.locate(mdBuilder.getJavadocArtifact()); > if (!ArtifactOrigin.isUnknown(javadocArtifact) > > Modified: > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=831776&r1=831775&r2=831776&view=diff > > ============================================================================== > --- > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java > (original) > +++ > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java > Sun Nov 1 22:57:30 2009 > @@ -38,8 +38,10 @@ > import org.apache.ivy.TestHelper; > import org.apache.ivy.core.cache.ArtifactOrigin; > import org.apache.ivy.core.cache.DefaultRepositoryCacheManager; > +import org.apache.ivy.core.deliver.DeliverOptions; > import org.apache.ivy.core.module.descriptor.Artifact; > import org.apache.ivy.core.module.descriptor.DefaultArtifact; > +import org.apache.ivy.core.module.descriptor.DependencyDescriptor; > import org.apache.ivy.core.module.descriptor.ModuleDescriptor; > import org.apache.ivy.core.module.id.ModuleId; > import org.apache.ivy.core.module.id.ModuleRevisionId; > @@ -4131,6 +4133,27 @@ > assertTrue(jarFileInCache.length() != sourceFileInCache.length()); > } > > + public void testResolveMaven2GetSourcesWithSrcClassifier() throws > Exception { > + // IVY-1138 > + Ivy ivy = new Ivy(); > + ivy.configure(new > File("test/repositories/m2/ivysettings.xml").toURL()); > + ResolveReport report = ivy.resolve( > + ResolveTest.class.getResource("ivy-m2-with-src.xml"), > + getResolveOptions(new String[] {"*"})); > + assertNotNull(report); > + assertFalse(report.hasError()); > + > + assertTrue(getIvyFileInCache( > + ModuleRevisionId.newInstance("org.apache", "test-src", > "1.0")).exists()); > + File jarFileInCache = getArchiveFileInCache(ivy, "org.apache", > "test-src", > + "1.0", "test-src", "jar", "jar"); > + assertTrue(jarFileInCache.exists()); > + File sourceFileInCache = getArchiveFileInCache(ivy, "org.apache", > "test-src", null, > + "1.0", "test-src", "source", "jar", > Collections.singletonMap("classifier", "src")); > + assertTrue(sourceFileInCache.exists()); > + assertTrue(jarFileInCache.length() != sourceFileInCache.length()); > + } > + > public void testResolveMaven2GetSourcesAndJavadocAuto() throws > Exception { > Ivy ivy = new Ivy(); > ivy.configure(new > File("test/repositories/m2/ivysettings.xml").toURL()); > > Added: > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml?rev=831776&view=auto > > ============================================================================== > --- > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml > (added) > +++ > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml > Sun Nov 1 22:57:30 2009 > @@ -0,0 +1,24 @@ > +<!-- > + 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. > +--> > +<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven"> > + <info organisation="apache" module="test-m2-with-src" revision="1.0" > /> > + <dependencies> > + <dependency org="org.apache" name="test-src" rev="1.0" > /> > + </dependencies> > +</ivy-module> > > Propchange: > ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml > > ------------------------------------------------------------------------------ > svn:mime-type = text/plain > > Added: > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0-src.jar > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0-src.jar?rev=831776&view=auto > > ============================================================================== > Binary file - no diff available. > > Propchange: > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0-src.jar > > ------------------------------------------------------------------------------ > svn:mime-type = application/octet-stream > > Added: > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.jar > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.jar?rev=831776&view=auto > > ============================================================================== > Binary file - no diff available. > > Propchange: > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.jar > > ------------------------------------------------------------------------------ > svn:mime-type = application/octet-stream > > Added: > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.pom > URL: > http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.pom?rev=831776&view=auto > > ============================================================================== > --- > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.pom > (added) > +++ > ant/ivy/core/trunk/test/repositories/m2/org/apache/test-src/1.0/test-src-1.0.pom > Sun Nov 1 22:57:30 2009 > @@ -0,0 +1,31 @@ > +<?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-src</artifactId> > + <name>Test Module for Ivy M2 parsing</name> > + <version>1.0</version> > + <url>http://ant.apache.org/ivy</url> > + <organization> > + <name>Jayasoft</name> > + <url>http://www.apache.org/</url> > + </organization> > +</project> > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@ant.apache.org For additional commands, e-mail: dev-h...@ant.apache.org