This is an automated email from the ASF dual-hosted git repository.

maartenc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant-ivy.git


The following commit(s) were added to refs/heads/master by this push:
     new aa3c1693 IVY-1664: added support for the override child element
aa3c1693 is described below

commit aa3c169322ce9a90176f066f30d4b7a837b20e38
Author: Maarten Coene <[email protected]>
AuthorDate: Sun Aug 31 14:41:54 2025 +0200

    IVY-1664: added support for the override child element
---
 META-INF/MANIFEST.MF                                |  2 +-
 asciidoc/release-notes.adoc                         |  1 +
 asciidoc/use/postresolvetask.adoc                   |  3 ++-
 asciidoc/use/resolve.adoc                           |  3 ++-
 src/java/org/apache/ivy/ant/IvyPostResolveTask.java |  4 ++++
 src/java/org/apache/ivy/ant/IvyResolve.java         | 15 ++++++++++++++-
 6 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index bc95c932..1dcde4b7 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -46,7 +46,7 @@ Import-Package: com.jcraft.jsch;resolution:=optional,
  org.xml.sax.ext,
  org.xml.sax.helpers
 Export-Package: org.apache.ivy;version="2.0.0",
- org.apache.ivy.ant;version="2.0.0",
+ org.apache.ivy.ant;version="2.6.0",
  org.apache.ivy.core;version="2.0.0",
  org.apache.ivy.core.cache;version="2.0.0",
  org.apache.ivy.core.check;version="2.0.0",
diff --git a/asciidoc/release-notes.adoc b/asciidoc/release-notes.adoc
index 25f94d8f..46720303 100644
--- a/asciidoc/release-notes.adoc
+++ b/asciidoc/release-notes.adoc
@@ -54,6 +54,7 @@ Note, if you have resolved dependencies with version of Ivy 
prior to 2.6.0, you
 
 - NEW: added a new `nearest` conflict manager, which handles conflicts in the 
same way that Maven does. (IVY-813) (Thanks to Eric Milles)
 - IMPROVEMENT: use Apache Commons Compress for pack200 handling to avoid 
issues on Java 14 and later. If pack200 is needed, make sure to add Apache 
Commons Compress to your classpath. (IVY-1652)
+- IMPROVEMENT: `ivy:retrieve` and the 'post resolve tasks' now support the 
`override` child element. (IVY-1664)
 - FIX: improved Maven dependencyManagement matching for dependencies with a 
non-default type or classifier (IVY-1654) (Thanks to Mark Kittisopikul)
 - FIX: the `ivy:retrieve` task failed when the retrieve pattern contained some 
text in parentheses before the first token, for instance: `/jobs/lib (JDK 
17)/[artifact].[ext]` (IVY-1660)
 - FIX: when the `ivy:deliver` task is configured to replace dynamic revisions, 
it now replaces these revisions to the resolved revision before any conflict 
resolution was done, which was the original behavior before Ivy 2.3.0.
diff --git a/asciidoc/use/postresolvetask.adoc 
b/asciidoc/use/postresolvetask.adoc
index ec87a83d..9e043825 100644
--- a/asciidoc/use/postresolvetask.adoc
+++ b/asciidoc/use/postresolvetask.adoc
@@ -83,7 +83,8 @@ There is one important difference with the ivy.xml's 
link:../ivyfile/dependencie
 |Element|Description|Cardinality
 |link:../ivyfile/dependency{outfilesuffix}[dependency]|declares a dependency 
to resolve|0..n
 |link:../ivyfile/exclude{outfilesuffix}[exclude]|excludes artifacts, modules 
or whole organizations from the set of dependencies to resolve|0..n
-|link:../ivyfile/override{outfilesuffix}[override]|specify an override 
mediation rule, overriding the revision and/or branch requested for a 
transitive dependency (*__since 2.0__*)|0..n
+|link:../ivyfile/override{outfilesuffix}[override]|specify an override 
mediation rule, overriding the revision and/or branch requested for a 
transitive dependency (*__since 2.6__*)|0..n
+|link:../ivyfile/conflict{outfilesuffix}[conflict]|specify a a conflict 
manager for one or several dependencies|0..n
 |=======
 
 == Examples
diff --git a/asciidoc/use/resolve.adoc b/asciidoc/use/resolve.adoc
index b022fe78..d8c3569c 100644
--- a/asciidoc/use/resolve.adoc
+++ b/asciidoc/use/resolve.adoc
@@ -148,7 +148,8 @@ There is one important difference with the ivy.xml's 
link:../ivyfile/dependencie
 |Element|Description|Cardinality
 |link:../ivyfile/dependency{outfilesuffix}[dependency]|declares a dependency 
to resolve|0..n
 |link:../ivyfile/exclude{outfilesuffix}[exclude]|excludes artifacts, modules 
or whole organizations from the set of dependencies to resolve|0..n
-|link:../ivyfile/override{outfilesuffix}[override]|specify an override 
mediation rule, overriding the revision and/or branch requested for a 
transitive dependency (*__since 2.0__*)|0..n
+|link:../ivyfile/override{outfilesuffix}[override]|specify an override 
mediation rule, overriding the revision and/or branch requested for a 
transitive dependency (*__since 2.6__*)|0..n
+|link:../ivyfile/conflict{outfilesuffix}[conflict]|specify a a conflict 
manager for one or several dependencies|0..n
 |=======
 
 == Examples
diff --git a/src/java/org/apache/ivy/ant/IvyPostResolveTask.java 
b/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
index 6565bd1f..de806615 100644
--- a/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
+++ b/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
@@ -105,6 +105,10 @@ public abstract class IvyPostResolveTask extends IvyTask {
         return resolve.createExclude();
     }
 
+    public IvyOverride createOverride() {
+      return resolve.createOverride();
+    }
+
     public IvyConflict createConflict() {
         return resolve.createConflict();
     }
diff --git a/src/java/org/apache/ivy/ant/IvyResolve.java 
b/src/java/org/apache/ivy/ant/IvyResolve.java
index 999c03c5..0c178de2 100644
--- a/src/java/org/apache/ivy/ant/IvyResolve.java
+++ b/src/java/org/apache/ivy/ant/IvyResolve.java
@@ -96,6 +96,8 @@ public class IvyResolve extends IvyTask {
 
     private List<IvyExclude> excludes = new ArrayList<>();
 
+    private List<IvyOverride> overrides = new ArrayList<>();
+
     private List<IvyConflict> conflicts = new ArrayList<>();
 
     public boolean isUseOrigin() {
@@ -225,6 +227,12 @@ public class IvyResolve extends IvyTask {
         return ex;
     }
 
+    public IvyOverride createOverride() {
+        IvyOverride o = new IvyOverride();
+        overrides.add(o);
+        return o;
+    }
+
     public IvyConflict createConflict() {
         IvyConflict c = new IvyConflict();
         conflicts.add(c);
@@ -246,7 +254,8 @@ public class IvyResolve extends IvyTask {
             type = getProperty(type, settings, 
"ivy.resolve.default.type.filter");
             String[] confs = splitToArray(conf);
 
-            boolean childs = !dependencies.isEmpty() || !excludes.isEmpty() || 
!conflicts.isEmpty();
+            boolean childs = !dependencies.isEmpty() || !excludes.isEmpty() || 
!overrides.isEmpty()
+                || !conflicts.isEmpty();
 
             ResolveReport report;
             if (childs) {
@@ -282,6 +291,10 @@ public class IvyResolve extends IvyTask {
                     md.addExcludeRule(rule);
                 }
 
+                for (IvyOverride override : overrides) {
+                  override.addOverride(md, settings);
+                }
+
                 for (IvyConflict conflict : conflicts) {
                     conflict.addConflict(md, settings);
                 }

Reply via email to