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 a4c22ca8 FIX: the 'ivy:install' task didn't take the 'from' resolver
into account when resolving Maven parent modules or source/javadoc artifacts.
a4c22ca8 is described below
commit a4c22ca869cc25eb07223c841321be86b8a9e801
Author: Maarten Coene <[email protected]>
AuthorDate: Wed May 20 09:09:40 2026 +0200
FIX: the 'ivy:install' task didn't take the 'from' resolver into account
when resolving Maven parent modules or source/javadoc artifacts.
---
META-INF/MANIFEST.MF | 2 +-
asciidoc/release-notes.adoc | 2 ++
.../parser/m2/PomModuleDescriptorParser.java | 19 +++++++++++++---
.../org/apache/ivy/core/install/InstallTest.java | 26 ++++++++++++++++++++++
.../repositories/ivysettings-nodefaultresolver.xml | 2 ++
5 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 1dcde4b7..05111fe7 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -87,7 +87,7 @@ Export-Package: org.apache.ivy;version="2.0.0",
org.apache.ivy.plugins.namespace;version="2.0.0",
org.apache.ivy.plugins.pack;version="2.6.0",
org.apache.ivy.plugins.parser;version="2.0.0",
- org.apache.ivy.plugins.parser.m2;version="2.0.0",
+ org.apache.ivy.plugins.parser.m2;version="2.6.0",
org.apache.ivy.plugins.parser.xml;version="2.0.0",
org.apache.ivy.plugins.report;version="2.0.0",
org.apache.ivy.plugins.repository;version="2.0.0",
diff --git a/asciidoc/release-notes.adoc b/asciidoc/release-notes.adoc
index 9bea0811..83e15cee 100644
--- a/asciidoc/release-notes.adoc
+++ b/asciidoc/release-notes.adoc
@@ -61,6 +61,7 @@ Note, if you have resolved dependencies with version of Ivy
prior to 2.6.0, you
This way, the delivered ivy.xml can be used to have reproducible dependency
resolution, especially when multiple configurations are used.
It also fixes issues where the dynamic revisions were replaced by versions
from other configurations. (IVY-1485, IVY-1661)
- FIX: the `ivy:deliver` task didn't replace dynamic revision from inherited
dependencies. (IVY-1410) (Thanks to Eric Milles)
+- FIX: the `ivy:install` task didn't take the `from` resolver into account
when resolving Maven parent modules or source/javadoc artifacts.
== Committers and Contributors
@@ -103,6 +104,7 @@ Here is the list of people who have contributed source code
and documentation up
* Mirko Bulovic
* Ed Burcher
* Jamie Burns
+* Colin Chambers
* Wei Chen
* Chris Chilvers
* Kristian Cibulskis
diff --git
a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
index 78d602fb..5a2a5a08 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
@@ -378,7 +378,14 @@ public final class PomModuleDescriptorParser implements
ModuleDescriptorParser {
ModuleDescriptor md = mdBuilder.getModuleDescriptor();
ModuleRevisionId mrid = md.getModuleRevisionId();
- DependencyResolver resolver = ivySettings.getResolver(mrid);
+
+ // get the resolver configured on the engine and if none is configured
then
+ // get the one configured in ivy settings
+ ResolveEngine engine =
IvyContext.getContext().getIvy().getResolveEngine();
+ DependencyResolver resolver = engine.getDictatorResolver();
+ if (resolver == null) {
+ resolver = ivySettings.getResolver(mrid);
+ }
if (resolver == null) {
Message.debug(
@@ -442,15 +449,21 @@ public final class PomModuleDescriptorParser implements
ModuleDescriptorParser {
}
try {
DependencyDescriptor dd = new
DefaultDependencyDescriptor(parentModRevID, true);
+ ResolveEngine engine =
IvyContext.getContext().getIvy().getResolveEngine();
ResolveData data = IvyContext.getContext().getResolveData();
if (data == null) {
- ResolveEngine engine =
IvyContext.getContext().getIvy().getResolveEngine();
ResolveOptions options = new ResolveOptions();
options.setDownload(false);
data = new ResolveData(engine, options);
}
- DependencyResolver resolver =
ivySettings.getResolver(parentModRevID);
+ // get the resolver configured on the engine and if none is
configured then
+ // get the one configured in ivy settings
+ DependencyResolver resolver = engine.getDictatorResolver();
+ if (resolver == null) {
+ resolver = ivySettings.getResolver(parentModRevID);
+ }
+
if (resolver == null) {
// TODO: Throw exception here?
return null;
diff --git a/test/java/org/apache/ivy/core/install/InstallTest.java
b/test/java/org/apache/ivy/core/install/InstallTest.java
index f4e453ba..c7a5e520 100644
--- a/test/java/org/apache/ivy/core/install/InstallTest.java
+++ b/test/java/org/apache/ivy/core/install/InstallTest.java
@@ -83,6 +83,32 @@ public class InstallTest {
assertTrue(new
File("build/test/install/org.apache/test/test-1.0.pom").exists());
}
+ @Test
+ public void testMavenParent() throws Exception {
+ Ivy ivy = Ivy.newInstance();
+ ivy.configure(new File("test/repositories/ivysettings.xml"));
+
+ @SuppressWarnings("unused")
+ ResolveReport rr =
ivy.install(ModuleRevisionId.newInstance("org.apache", "test-parent", "1.0"),
+
ivy.getSettings().getDefaultResolver().getName(), "install", new
InstallOptions());
+
+ assertTrue(new
File("build/test/install/org.apache/test-parent/ivy-1.0.xml").exists());
+ assertTrue(new
File("build/test/install/org.apache/test-parent/test-parent-1.0.jar").exists());
+ }
+
+ @Test
+ public void testMavenParentWithoutDefaultResolver() throws Exception {
+ Ivy ivy = Ivy.newInstance();
+ ivy.configure(new
File("test/repositories/ivysettings-nodefaultresolver.xml"));
+
+ @SuppressWarnings("unused")
+ ResolveReport rr =
ivy.install(ModuleRevisionId.newInstance("org.apache", "test-parent", "1.0"),
+ "test", "install", new
InstallOptions());
+
+ assertTrue(new
File("build/test/install/org.apache/test-parent/ivy-1.0.xml").exists());
+ assertTrue(new
File("build/test/install/org.apache/test-parent/test-parent-1.0.jar").exists());
+ }
+
@Test
public void testNoValidate() throws Exception {
Ivy ivy = Ivy.newInstance();
diff --git a/test/repositories/ivysettings-nodefaultresolver.xml
b/test/repositories/ivysettings-nodefaultresolver.xml
index f61661e1..aaada278 100644
--- a/test/repositories/ivysettings-nodefaultresolver.xml
+++ b/test/repositories/ivysettings-nodefaultresolver.xml
@@ -34,6 +34,8 @@
<artifact
pattern="${ivy.settings.dir}/2/[module]/[artifact].[ext]"/>
</filesystem>
</dual>
+ <ibiblio name="m2" m2compatible="true"
useMavenMetadata="true"
+ root="${ivy.settings.dir.url}/m2" />
</chain>
<filesystem name="install">
<ivy
pattern="${ivy.basedir}/build/test/install/[organisation]/[module]/[artifact]-[revision].[ext]"/>