Author: maartenc
Date: Mon Mar 22 21:24:51 2010
New Revision: 926346

URL: http://svn.apache.org/viewvc?rev=926346&view=rev
Log:
FIX: Can't deal with [VERSION] version pattern from Maven (IVY-1177) (thanks to 
Richard Vowles)

Modified:
    ant/ivy/core/trunk/CHANGES.txt
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=926346&r1=926345&r2=926346&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Mon Mar 22 21:24:51 2010
@@ -93,6 +93,7 @@ for detailed view of each issue, please 
        Johan Stuyts
        Jason Trump
        Tjeerd Verhagen
+       Richard Vowles
        Sven Walter
        James P. White
        Tom Widmer
@@ -116,6 +117,7 @@ for detailed view of each issue, please 
 - 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)
 
+- FIX: Can't deal with [VERSION] version pattern from Maven (IVY-1177) (thanks 
to Richard Vowles)
 - FIX: verbose/debug messages were not logged while running ivy:configure task
 - FIX: ApacheURLLister does not allow directories not containing a dot on 
Artifactory (IVY-1175) (thanks to Anders Jacobsson)
 - FIX: artifact-lock strategy could hang Ivy when resolving dynamic revisions

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java?rev=926346&r1=926345&r2=926346&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java 
(original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java 
Mon Mar 22 21:24:51 2010
@@ -210,7 +210,7 @@ public class ModuleRevisionId extends Un
             // just to get the default branch
             ? (context.peekIvy() == null ? null : 
context.getSettings().getDefaultBranch(moduleId)) 
             : branch;
-        this.revision = revision == null ? Ivy.getWorkingRevision() : revision;
+        this.revision = revision == null ? Ivy.getWorkingRevision() : 
normalizeRevision(revision);
         setStandardAttribute(IvyPatternHelper.ORGANISATION_KEY, 
this.moduleId.getOrganisation());
         setStandardAttribute(IvyPatternHelper.MODULE_KEY, 
this.moduleId.getName());
         setStandardAttribute(IvyPatternHelper.BRANCH_KEY, this.branch);
@@ -337,4 +337,16 @@ public class ModuleRevisionId extends Un
     public String getBranch() {
         return branch;
     }
+    
+    /**
+     * [revision] is a valid revision in maven. This method strips the '[' and 
']'
+     * characters. Cfr. http://docs.codehaus.org/x/IGU
+     */
+    private static String normalizeRevision(String revision) {
+        if (revision.startsWith("[") && revision.endsWith("]") && 
revision.indexOf(',') == -1 ) {
+            return revision.substring(1, revision.length() - 1);
+        } else {
+            return revision;
+        }
+    }
 }


Reply via email to