Re: [PR] IVY-1653: `makepom`: write overrides to Mav en `dependencyManagement` section [ant-ivy]
maartenc (via GitHub) <[email protected]> Tue, 16 Jun 2026 18:07:30 -0000
| Newsgroups | gmane.comp.jakarta.ant.devel |
|---|---|
| Message-ID | <PR_kwDOATT2Es6izEsm-d7d953eb-eef3-4088-ba26-cd887f78d9a6@gitbox.apache.org> |
maartenc commented on code in PR #114:
URL: https://github.com/apache/ant-ivy/pull/114#discussion_r3422953631
##########
src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorWriter.java:
##########
@@ -342,8 +359,53 @@ private static void printExclusions(ExcludeRule[] exclusions, PrintWriter out, i
out.println("</exclusions>");
}
- private static DependencyDescriptor[] getDependencies(ModuleDescriptor md,
- PomWriterOptions options) {
+ private static void printOverrides(ModuleDescriptor md, PrintWriter out, int indent, boolean container) {
+ ModuleRules<DependencyDescriptorMediator> mr = md.getAllDependencyDescriptorMediators();
+ if (mr.getAllRules().isEmpty()) {
+ return;
+ }
+
+ if (container) {
+ indent(out, indent);
+ out.println("<dependencyManagement>");
+ indent(out, indent * 2);
+ out.println("<dependencies>");
+ } else {
+ indent /= 2; // <dependencies> is second-level child of <project>
+ }
+
+ for (Map.Entry<MapMatcher, DependencyDescriptorMediator> entry : mr.getAllRules().entrySet()) {
+ if (entry.getValue() instanceof OverrideDependencyDescriptorMediator) {
+ String artifactId = entry.getKey().getAttributes().get("module");
+ String groupId = entry.getKey().getAttributes().get("organisation");
+ String version = ((OverrideDependencyDescriptorMediator) entry.getValue()).getVersion();
+
+ if (artifactId == null || artifactId.equals("*") || groupId == null || groupId.equals("*")) {
+ continue;
+ }
Review Comment:
Maybe we should filter first. If all overrides contain a wildcard, then we also don't need to add an empty `<dependencyManagement>`/`<dependencies>` section.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]