ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r689453 - in /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver: AbstractResourceResolver.java IBiblioResolver.java
Date Wed, 27 Aug 2008 12:00:35 GMT
Author: xavier
Date: Wed Aug 27 05:00:34 2008
New Revision: 689453

URL: http://svn.apache.org/viewvc?rev=689453&view=rev
Log:
FIX: listing bug introduced when implementing IVY-886

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java?rev=689453&r1=689452&r2=689453&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResourceResolver.java
Wed Aug 27 05:00:34 2008
@@ -256,6 +256,7 @@
         List ivyPatterns = getIvyPatterns();
         Map tokenValues = new HashMap(criteria);
         tokenValues.put(IvyPatternHelper.TYPE_KEY, "ivy");
+        tokenValues.put(IvyPatternHelper.EXT_KEY, "xml");
         if (isM2compatible()) {
             convertM2TokenValuesForResourceSearch(tokenValues);
         }
@@ -268,6 +269,7 @@
             List artifactPatterns = getArtifactPatterns();
             tokenValues = new HashMap(criteria);
             tokenValues.put(IvyPatternHelper.TYPE_KEY, "jar");
+            tokenValues.put(IvyPatternHelper.EXT_KEY, "jar");
             if (isM2compatible()) {
                 convertM2TokenValuesForResourceSearch(tokenValues);
             }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java?rev=689453&r1=689452&r2=689453&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/IBiblioResolver.java Wed Aug
27 05:00:34 2008
@@ -329,25 +329,37 @@
         if (IvyPatternHelper.REVISION_KEY.equals(token) 
                 && isM2compatible()
                 && isUseMavenMetadata()) {
-            /*
-             * we substitute tokens with no token at all with the m2 per module pattern,
to remove
-             * optional tokens as it has been done in the given pattern which itself has
gone
-             * through a partial substitute tokens
-             */
-            String partiallyResolvedM2PerModulePattern = IvyPatternHelper.substituteTokens(
-                M2_PER_MODULE_PATTERN, Collections.EMPTY_MAP);
-            if (pattern.endsWith(partiallyResolvedM2PerModulePattern)) {
+            if (((String) getIvyPatterns().get(0)).endsWith(M2_PER_MODULE_PATTERN)) {
+                // now we must use metadata if available
                 /*
-                 * the given pattern already contain resolved org and module, we just have
to
-                 * replace the per module pattern at the end by 'maven-metadata.xml' to have
the
-                 * maven metadata file location
+                 * we substitute tokens with ext token only in the m2 per module pattern,
to match
+                 * has has been done in the given pattern
                  */
-                String metadataLocation = pattern.substring(0, pattern
+                String partiallyResolvedM2PerModulePattern = IvyPatternHelper.substituteTokens(
+                    M2_PER_MODULE_PATTERN, 
+                    Collections.singletonMap(IvyPatternHelper.EXT_KEY, "xml"));
+                if (pattern.endsWith(partiallyResolvedM2PerModulePattern)) {
+                    /*
+                     * the given pattern already contain resolved org and module, we just
have to
+                     * replace the per module pattern at the end by 'maven-metadata.xml'
to have the
+                     * maven metadata file location
+                     */
+                    String metadataLocation = pattern.substring(0, pattern
                         .lastIndexOf(partiallyResolvedM2PerModulePattern))
                         + "maven-metadata.xml";
-                List revs = listRevisionsWithMavenMetadata(getRepository(), metadataLocation);
-                if (revs != null) {
-                    return (String[]) revs.toArray(new String[revs.size()]);
+                    List revs = listRevisionsWithMavenMetadata(getRepository(), metadataLocation);
+                    if (revs != null) {
+                        return (String[]) revs.toArray(new String[revs.size()]);
+                    }
+                } else {
+                    /*
+                     * this is probably because the given pattern has been substituted with
jar ext,
+                     * if this resolver has optional module descriptors. But since we have
to use
+                     * maven metadata, we don't care about this case, maven metadata has
already
+                     * been used when looking for revisions with the pattern substituted
with
+                     * ext=xml for the "ivy" pattern.
+                     */  
+                    return new String[0];
                 }
             }
         }



Mime
View raw message