Subject: [bug#52723] [PATCH 05/26] gnu: maven-parent-pom: Fix dependency versions.

From: Julien Lepiller <[email-masked]>
Date: Tue, 21 Dec 2021 23:44:49 +0100

* gnu/packages/maven-parent-pom.scm (make-maven-parent-pom): Add a
replacement option.
(maven-parent-pom-34, maven-parent-pom-33, maven-parent-pom-31,
maven-parent-pom-22, maven-parent-pom-15): Replace
java-plexus-component-annotations version.
---
 gnu/packages/maven-parent-pom.scm | 44 ++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/maven-parent-pom.scm b/gnu/packages/maven-parent-pom.scm
index 19f1bc5007..6d11c84f44 100644
--- a/gnu/packages/maven-parent-pom.scm
+++ b/gnu/packages/maven-parent-pom.scm
@@ -395,7 +395,7 @@ (define-public plexus-parent-pom-8
   (make-plexus-parent-pom
     "8" "0ybwdzawa58qg9ag39rxyin24lk9sjcaih6n2yfldfzsbkq6gnww"))
 
-(define (make-maven-parent-pom version hash parent)
+(define* (make-maven-parent-pom version hash parent #:key replacements)
   (hidden-package
     (package
       (name "maven-parent-pom")
@@ -418,6 +418,12 @@ (define (make-maven-parent-pom version hash parent)
              (install-pom-file "maven-plugins/pom.xml"))
            (add-after 'install 'install-shared
              (install-pom-file "maven-shared-components/pom.xml"))
+           ,@(if replacements
+                 `((add-before 'install 'fix-pom
+                    (lambda _
+                      (use-modules (guix build maven pom))
+                      (fix-pom-dependencies "pom.xml" '() #:local-packages (quote ,(force replacements))))))
+                 '())
            (replace 'install
              (install-pom-file "pom.xml")))))
       (propagated-inputs
@@ -431,17 +437,32 @@ (define (make-maven-parent-pom version hash parent)
 (define-public maven-parent-pom-34
   (make-maven-parent-pom
     "34" "1vkmrfwva76k6maf1ljbja5ga4kzav4xc73ymbaf42xaiaknglbc"
-    apache-parent-pom-23))
+    apache-parent-pom-23
+    #:replacements
+    (delay
+      `(("org.codehaus.plexus"
+         ("plexus-component-annotations" .
+          ,(package-version java-plexus-component-annotations)))))))
 
 (define-public maven-parent-pom-33
   (make-maven-parent-pom
     "33" "1b0z2gsvpccgcssys9jbdfwlwq8b5imdwr508f87ssdbfs29lh65"
-    apache-parent-pom-21))
+    apache-parent-pom-21
+    #:replacements
+    (delay
+      `(("org.codehaus.plexus"
+         ("plexus-component-annotations" .
+          ,(package-version java-plexus-component-annotations)))))))
 
 (define-public maven-parent-pom-31
   (make-maven-parent-pom
     "31" "0skxv669v9ffwbmrmybnn9awkf1g3ylk88bz0hv6g11zpj1a8454"
-    apache-parent-pom-19))
+    apache-parent-pom-19
+    #:replacements
+    (delay
+      `(("org.codehaus.plexus"
+         ("plexus-component-annotations" .
+          ,(package-version java-plexus-component-annotations)))))))
 
 (define-public maven-parent-pom-30
   (make-maven-parent-pom
@@ -477,7 +498,12 @@ (define-public maven-parent-pom-15
 (define-public maven-parent-pom-22
   (let ((base (make-maven-parent-pom
                 "22" "1kgqbyx7ckashy47n9rgyg4asyrvp933hdiknvnad7msq5d4c2jg"
-                apache-parent-pom-11)))
+                apache-parent-pom-11
+                #:replacements
+                (delay
+                  `(("org.codehaus.plexus"
+                     ("plexus-component-annotations" .
+                      ,(package-version java-plexus-container-default))))))))
     (package
       (inherit base)
       (arguments
@@ -485,13 +511,7 @@ (define-public maven-parent-pom-22
          ((#:phases phases)
           `(modify-phases ,phases
              (delete 'install-plugins)
-             (delete 'install-shared)
-             (add-before 'install 'fix-versions
-               (lambda _
-                 (substitute* "pom.xml"
-                   (("1.5.5")
-                    ,(package-version java-plexus-component-annotations)))
-                 #t)))))))))
+             (delete 'install-shared))))))))
 
 (define-public maven-plugins-pom-23
   (hidden-package
-- 
2.34.0