GNU bug report logs - #48766
[PATCH] gnu: java-jmh: Switch to maven-build-system.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Mon, 31 May 2021 22:42:01 UTC

Severity: normal

Tags: patch

Done: Julien Lepiller <julien <at> lepiller.eu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48766 in the body.
You can then email your comments to 48766 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:42:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Julien Lepiller <julien <at> lepiller.eu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 31 May 2021 22:42:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: java-jmh: Switch to maven-build-system.
Date: Tue, 1 Jun 2021 00:41:00 +0200
Hi Guix!

I'm excited to submit this patch series, as it adds the first package
to guix that uses the maven-build-system.

The series first improves the maven build system, so it actually works
with jmh :)

The series then changes a few dependencies to install to the maven
repository structure (lib/m2), so they can be detected by maven during
the build.

Since the series updates files that are used by the ant-build-system,
it unfortunately needs to update all java packages. Grepping for
"build-system ant-build-system", it shows 302 packages, which is
two packages above the limit for master. However, since most java
packages are fast to build, I'd like to ask for an exception to this
rule and push to master directly.

Patches will follow :)




Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:02 GMT) Full text and rfc822 format available.

Message #8 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 01/14] guix: java-utils: Factorize pom.xml generation.
Date: Tue,  1 Jun 2021 00:44:14 +0200
* guix/build/java-utils.scm (generate-pom.xml): New procedure.
* gnu/packages/maven.scm (java-surefire-junit4): Use it.
* gnu/packages/java.scm (java-qdox, java-jsr250, java-jsr305)
(java-aopalliance, java-jboss-el-api-spec)
(java-jboss-interceptors-api-spec): Use it.
(java-qdox-M9): Ensure the generated pom file has the correct version.
---
 gnu/packages/java.scm     | 117 ++++++--------------------------------
 gnu/packages/maven.scm    |  28 ++++-----
 guix/build/java-utils.scm |  29 ++++++++++
 3 files changed, 58 insertions(+), 116 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index a167aafc38..d7118b4ce6 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3781,25 +3781,11 @@ documentation tools.")
     (arguments
      `(#:jar-name "qdox.jar"
        #:tests? #f; no tests
-       #:modules
-       ((guix build ant-build-system)
-        (guix build java-utils)
-        (guix build utils)
-        (sxml simple))
        #:phases
        (modify-phases %standard-phases
          (add-before 'install 'create-pom
-           (lambda _
-             (with-output-to-file "pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `((project
-                       (modelVersion "4.0.0")
-                       (name "QDox")
-                       (groupId "com.thoughtworks.qdox")
-                       (artifactId "qdox")
-                       (version ,,version))))))
-             #t))
+           (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version
+                             #:name "QDox"))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (home-page "https://github.com/codehaus/qdox")
@@ -3825,7 +3811,14 @@ documentation tools.")
                                   "/qdox-" version "-sources.jar"))
               (sha256
                (base32
-                "1s2jnmx2dkwnaha12lcj26aynywgwa8sslc47z82wx8xai13y4fg"))))))
+                "1s2jnmx2dkwnaha12lcj26aynywgwa8sslc47z82wx8xai13y4fg"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments java-qdox)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'create-pom
+             (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version
+                               #:name "QDox"))))))))
 
 (define-public java-jarjar
   (package
@@ -6397,25 +6390,11 @@ bottlenecks move away from the database in an effectively cached system.")
      `(#:tests? #f ; no tests included
        #:jdk ,icedtea-8
        #:jar-name "jsr250.jar"
-       #:modules ((guix build ant-build-system)
-                  (guix build utils)
-                  (guix build maven pom)
-                  (guix build java-utils)
-                  (sxml simple))
        #:phases
        (modify-phases %standard-phases
          (add-before 'install 'create-pom
-           (lambda _
-             (with-output-to-file "pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `((project
-                       (modelVersion "4.0.0")
-                       (name "jsr250")
-                       (groupId "javax.annotation")
-                       (artifactId "jsr250-api")
-                       (version ,,version))))))
-             #t))
+           (generate-pom.xml "pom.xml" "javax.annotation" "jsr250-api" ,version
+                             #:name "jsr250"))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (home-page "https://jcp.org/en/jsr/detail?id=250")
@@ -6444,25 +6423,10 @@ namespaces.")
     (arguments
      `(#:tests? #f ; no tests included
        #:jar-name "jsr305.jar"
-       #:modules ((guix build ant-build-system)
-                  (guix build java-utils)
-                  (guix build maven pom)
-                  (guix build utils)
-                  (sxml simple))
        #:phases
        (modify-phases %standard-phases
          (add-before 'install 'create-pom
-           (lambda _
-             (with-output-to-file "pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `((project
-                       (modelVersion "4.0.0")
-                       (name "jsr305")
-                       (groupId "com.google.code.findbugs")
-                       (artifactId "jsr305")
-                       (version ,,version))))))
-             #t))
+           (generate-pom.xml "pom.xml" "com.google.code.findbugs" "jsr305" ,version))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (home-page "http://findbugs.sourceforge.net/")
@@ -10493,25 +10457,10 @@ this is not a static analysis tool.)")
        #:jdk ,icedtea-8
        #:tests? #f; no tests
        #:source-dir "aopalliance/src/main"
-       #:modules ((guix build ant-build-system)
-                  (guix build utils)
-                  (guix build maven pom)
-                  (guix build java-utils)
-                  (sxml simple))
        #:phases
        (modify-phases %standard-phases
          (add-before 'install 'create-pom
-           (lambda _
-             (with-output-to-file "pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `((project
-                       (modelVersion "4.0.0")
-                       (name "aopalliance")
-                       (groupId "aopalliance")
-                       (artifactId "aopalliance")
-                       (version "1.0"))))))
-             #t))
+           (generate-pom.xml "pom.xml" "aopalliance" "aopalliance" ,version))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (home-page "http://aopalliance.sourceforge.net")
@@ -12110,29 +12059,14 @@ sequences to format your console output which works on every platform.")
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "java-jboss-el-api_spec.jar"
-       #:modules ((guix build ant-build-system)
-                  (guix build utils)
-                  (guix build maven pom)
-                  (guix build java-utils)
-                  (sxml simple))
        #:phases
        (modify-phases %standard-phases
          ;; the origin of javax.el:javax.el-api is unknown, so we use this package
          ;; instead, which implements the same thing.  We override the pom file
          ;; to "rename" the package so it can be found by maven.
          (add-before 'install 'override-pom
-           (lambda _
-             (delete-file "pom.xml")
-             (with-output-to-file "pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `(project
-                      (modelVersion "4.0.0")
-                      (name "el-api")
-                      (groupId "javax.el")
-                      (artifactId "javax.el-api")
-                      (version "3.0")))))
-             #t))
+           (generate-pom.xml "pom.xml" "javax.el" "javax.el-api" "3.0"
+                             #:name "el-api"))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (inputs
@@ -12164,11 +12098,6 @@ JavaServer Pages (JSP).")
        #:jdk ,icedtea-8
        #:source-dir "."
        #:tests? #f; no tests
-       #:modules ((guix build ant-build-system)
-                  (guix build utils)
-                  (guix build maven pom)
-                  (guix build java-utils)
-                  (sxml simple))
        #:phases
        (modify-phases %standard-phases
          ;; the origin of javax.interceptor:javax.interceptor-api is unknown,
@@ -12176,18 +12105,8 @@ JavaServer Pages (JSP).")
          ;; We override the pom file to "rename" the package so it can be found
          ;; by maven.
          (add-before 'install 'override-pom
-           (lambda _
-             (delete-file "pom.xml")
-             (with-output-to-file "pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `(project
-                      (modelVersion "4.0.0")
-                      (name "interceptor-api")
-                      (groupId "javax.interceptor")
-                      (artifactId "javax.interceptor-api")
-                      (version "3.0")))))
-             #t))
+           (generate-pom.xml "pom.xml" "javax.interceptor" "javax.interceptor-api"
+                             "3.0" #:name "interceptor-api"))
          (replace 'install
            (install-from-pom "pom.xml")))))
     (home-page "https://github.com/jboss/jboss-interceptors-api_spec")
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index c637e5c7ae..8f63ee9be2 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -3424,23 +3424,17 @@ starting from JUnit 4.")))
        #:phases
        (modify-phases %standard-phases
          (add-before 'install 'regenerate-own-pom
-           (lambda _
-             ;; Surefire struggles resolving artifacts because of this pom
-             ;; file, resulting in a NullPointerException when collecting
-             ;; Artifacts (and a "Failure detected." message from
-             ;; DefaultArtifactResolver).  Replace the pom file with a much
-             ;; simpler one.  Everything is shaded anyway (as used to be the
-             ;; case in 2.22), so there will not be missing dependencies.
-             (with-output-to-file "surefire-providers/surefire-junit4/pom.xml"
-               (lambda _
-                 (sxml->xml
-                   `((project
-                       (modelVersion "4.0.0")
-                       (name "Surefire JUnit4")
-                       (groupId "org.apache.maven.surefire")
-                       (artifactId "surefire-junit4")
-                       (version ,,(package-version java-surefire-common-java5)))))))
-             #t))
+           ;; Surefire struggles resolving artifacts because of this pom
+           ;; file, resulting in a NullPointerException when collecting
+           ;; Artifacts (and a "Failure detected." message from
+           ;; DefaultArtifactResolver).  Replace the pom file with a much
+           ;; simpler one.  Everything is shaded anyway (as used to be the
+           ;; case in 2.22), so there will not be missing dependencies.
+           (generate-pom.xml
+             "surefire-providers/surefire-junit4/pom.xml"
+             "org.apache.maven.surefire" "surefire-junit4"
+             ,(package-version java-surefire-common-java5)
+             #:name "Surefire JUnit4"))
          (add-before 'build 'copy-resources
            (lambda _
              (mkdir-p "build/classes")
diff --git a/guix/build/java-utils.scm b/guix/build/java-utils.scm
index a868e4d52c..6abd97e118 100644
--- a/guix/build/java-utils.scm
+++ b/guix/build/java-utils.scm
@@ -28,6 +28,7 @@
   #:use-module (sxml simple)
   #:export (ant-build-javadoc
             generate-plugin.xml
+            generate-pom.xml
             install-jars
             install-javadoc
             install-pom-file
@@ -206,3 +207,31 @@ recognize the package as a plugin, and find the entry points in the plugin."
                  ,mojos
                  (dependencies
                   ,@dependencies)))))))))
+
+(define* (generate-pom.xml pom-file groupid artifactid version
+                           #:key (dependencies '())
+                                 (name artifactid))
+  "Generates the @file{pom.xml} for a project. It is required by Maven to find
+a package, and by the java build system to know where to install a package, when
+a pom.xml doesn't already exist and installing to the maven repository."
+  (lambda _
+    (mkdir-p (dirname pom-file))
+    (with-output-to-file pom-file
+      (lambda _
+        (sxml->xml
+          (sxml-indent
+            `(project
+               (modelVersion "4.0.0")
+               (name ,name)
+               (groupId ,groupid)
+               (artifactId ,artifactid)
+               (version ,version)
+               (dependencies
+                ,@(map
+                    (match-lambda
+                      ((groupid artifactid version)
+                      `(dependency
+                         (groupId ,groupid)
+                         (artifactId ,artifactid)
+                         (version ,version))))
+                    dependencies)))))))))
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:02 GMT) Full text and rfc822 format available.

Message #11 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 02/14] guix: maven: Simplify finding version and group
 information.
Date: Tue,  1 Jun 2021 00:44:15 +0200
* guix/build/maven/pom.scm (pom-version, pom-groupid): Do not use inputs
and local packages information anymore. Adapt file to new arguments.
* guix/build/maven-build-system.scm: Adapt to new arguments.
* guix/build/java-utils.scm: Adapt to new arguments.
---
 guix/build/java-utils.scm         | 18 +++++++++---------
 guix/build/maven-build-system.scm |  6 +++---
 guix/build/maven/pom.scm          | 26 ++++++++++++--------------
 3 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/guix/build/java-utils.scm b/guix/build/java-utils.scm
index 6abd97e118..5a54a14c1b 100644
--- a/guix/build/java-utils.scm
+++ b/guix/build/java-utils.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2016 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;; Copyright © 2016 Ricardo Wurmus <rekado <at> elephly.net>
 ;;; Copyright © 2018 Alex Vong <alexvong1995 <at> gmail.com>
-;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2020, 2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,9 +69,9 @@ fetched."
     (let* ((out (assoc-ref outputs "out"))
            (java-inputs (append (map cdr inputs) (map cdr outputs)))
            (pom-content (get-pom pom-file))
-           (version (pom-version pom-content java-inputs))
+           (version (pom-version pom-content))
            (artifact (pom-artifactid pom-content))
-           (group (group->dir (pom-groupid pom-content java-inputs)))
+           (group (group->dir (pom-groupid pom-content)))
            (repository (string-append out "/lib/m2/" group "/" artifact "/"
                                       version "/"))
            (pom-name (string-append repository artifact "-" version ".pom")))
@@ -87,8 +87,8 @@ to ensure that maven can find dependencies."
          (manifest (string-append dir "/META-INF/MANIFEST.MF"))
          (pom (get-pom pom-file))
          (artifact (pom-artifactid pom))
-         (group (pom-groupid pom inputs))
-         (version (pom-version pom inputs))
+         (group (pom-groupid pom))
+         (version (pom-version pom))
          (pom-dir (string-append "META-INF/maven/" group "/" artifact)))
     (mkdir-p (string-append dir "/" pom-dir))
     (copy-file pom-file (string-append dir "/" pom-dir "/pom.xml"))
@@ -113,9 +113,9 @@ the phase fails."
     (let* ((out (assoc-ref outputs "out"))
            (java-inputs (append (map cdr inputs) (map cdr outputs)))
            (pom-content (get-pom pom-file))
-           (version (pom-version pom-content java-inputs))
+           (version (pom-version pom-content))
            (artifact (pom-artifactid pom-content))
-           (group (group->dir (pom-groupid pom-content java-inputs)))
+           (group (group->dir (pom-groupid pom-content)))
            (repository (string-append out "/lib/m2/" group "/" artifact "/"
                                       version "/"))
            ;; We try to find the file that was built.  If it was built from our
@@ -180,9 +180,9 @@ recognize the package as a plugin, and find the entry points in the plugin."
            (name (pom-name pom-content))
            (description (pom-description pom-content))
            (dependencies (pom-dependencies pom-content))
-           (version (pom-version pom-content java-inputs))
+           (version (pom-version pom-content))
            (artifact (pom-artifactid pom-content))
-           (groupid (pom-groupid pom-content java-inputs))
+           (groupid (pom-groupid pom-content))
            (mojos
             `(mojos
                ,@(with-directory-excursion directory
diff --git a/guix/build/maven-build-system.scm b/guix/build/maven-build-system.scm
index 534b4ebcee..0456bfdf61 100644
--- a/guix/build/maven-build-system.scm
+++ b/guix/build/maven-build-system.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2020 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2020, 2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -82,8 +82,8 @@
   (let* ((pom (get-pom pom-file))
          (java-inputs (map cdr inputs))
          (artifact (pom-artifactid pom))
-         (group (pom-groupid pom java-inputs local-packages))
-         (version (pom-version pom java-inputs local-packages)))
+         (group (pom-groupid pom))
+         (version (pom-version pom)))
     (let loop ((modules (pom-ref pom "modules"))
                (local-packages
                  (add-local-package local-packages group artifact version)))
diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm
index c92d409d2b..327d5f75e8 100644
--- a/guix/build/maven/pom.scm
+++ b/guix/build/maven/pom.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2019, 2020 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2019-2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -93,13 +93,12 @@ If no result is found, the result is @code{#f}."
               (get-pom (car java-inputs))))
         #f)))
 
-(define* (pom-groupid content inputs #:optional local-packages)
+(define* (pom-groupid content)
   "Find the groupID of a pom file, potentially looking at its parent pom file.
 See @code{find-parent} for the meaning of the arguments."
   (if content
     (let ((res (or (pom-ref content "groupId")
-                   (pom-groupid (find-parent content inputs local-packages)
-                                inputs))))
+                   (pom-ref (pom-ref content "parent") "groupId"))))
       (cond
         ((string? res) res)
         ((null? res) #f)
@@ -114,13 +113,12 @@ See @code{find-parent} for the meaning of the arguments."
       (car res)
       #f)))
 
-(define* (pom-version content inputs #:optional local-packages)
+(define* (pom-version content)
   "Find the version of a pom file, potentially looking at its parent pom file.
 See @code{find-parent} for the meaning of the arguments."
   (if content
     (let ((res (or (pom-ref content "version")
-                   (pom-version (find-parent content inputs local-packages)
-                                inputs))))
+                   (pom-ref (pom-ref content "parent") "version"))))
       (cond
         ((string? res) res)
         ((null? res) #f)
@@ -344,7 +342,7 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
       ((tag rest ...)
        (match tag
          (('http://maven.apache.org/POM/4.0.0:plugin plugin ...)
-          (let ((group (or (pom-groupid plugin inputs) "org.apache.maven.plugins"))
+          (let ((group (or (pom-groupid plugin) "org.apache.maven.plugins"))
                 (artifact (pom-artifactid plugin)))
             (if (member artifact (or (assoc-ref excludes group) '()))
               (fix-plugins rest optional?)
@@ -355,11 +353,11 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
 
   (define* (fix-plugin plugin #:optional optional?)
     (let* ((artifact (pom-artifactid plugin))
-           (group (or (pom-groupid plugin inputs) "org.apache.maven.plugins"))
+           (group (or (pom-groupid plugin) "org.apache.maven.plugins"))
            (version (or (assoc-ref (assoc-ref local-packages group) artifact)
                         (find-version inputs group artifact optional?)
-                        (pom-version plugin inputs))))
-      (if (pom-version plugin inputs)
+                        (pom-version plugin))))
+      (if (pom-version plugin)
         (map
           (lambda (tag)
             (match tag
@@ -373,7 +371,7 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
 
   (define* (fix-dep dep #:optional optional?)
     (let* ((artifact (pom-artifactid dep))
-           (group (or (pom-groupid dep inputs) (pom-groupid pom inputs)))
+           (group (or (pom-groupid dep) (pom-groupid pom)))
            (scope (pom-ref dep "scope"))
            (is-optional? (equal? (pom-ref dep "optional") '("true"))))
       (format (current-error-port) "maven: ~a:~a :: ~a (optional: ~a)~%"
@@ -382,8 +380,8 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
               with-build-dependencies?)
           (let ((version (or (assoc-ref (assoc-ref local-packages group) artifact)
                              (find-version inputs group artifact optional?)
-                             (pom-version dep inputs))))
-            (if (pom-version dep inputs)
+                             (pom-version dep))))
+            (if (pom-version dep)
               (map
                 (lambda (tag)
                   (match tag
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:02 GMT) Full text and rfc822 format available.

Message #14 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 03/14] guix: maven: Simplify finding local packages and
 modules.
Date: Tue,  1 Jun 2021 00:44:16 +0200
* guix/build/maven-build-system (fix-pom): Fix a single pom file without
recursing
(fix-pom-files): Find local packages and all submodules, and fix them
all at once.
(add-local-package): Move to...
* guix/build/maven/pom.scm (add-local-package): ...here.
(pom-and-submodules, pom-local-packages): New procedures.
---
 guix/build/maven-build-system.scm | 41 +++++-------------------
 guix/build/maven/pom.scm          | 53 ++++++++++++++++++++++++++++++-
 2 files changed, 60 insertions(+), 34 deletions(-)

diff --git a/guix/build/maven-build-system.scm b/guix/build/maven-build-system.scm
index 0456bfdf61..374fa2fdb8 100644
--- a/guix/build/maven-build-system.scm
+++ b/guix/build/maven-build-system.scm
@@ -60,47 +60,22 @@
   (invoke "mvn" "-v")
   #t)
 
-(define (add-local-package local-packages group artifact version)
-  (define (alist-set lst key val)
-    (match lst
-      ('() (list (cons key val)))
-      (((k . v) lst ...)
-       (if (equal? k key)
-         (cons (cons key val) lst)
-         (cons (cons k v) (alist-set lst key val))))))
-  (alist-set local-packages group
-    (alist-set (or (assoc-ref local-packages group) '()) artifact
-      version)))
-
 (define (fix-pom pom-file inputs local-packages excludes)
   (chmod pom-file #o644)
   (format #t "fixing ~a~%" pom-file)
   (fix-pom-dependencies pom-file (map cdr inputs)
                         #:with-plugins? #t #:with-build-dependencies? #t
                         #:local-packages local-packages
-                        #:excludes excludes)
-  (let* ((pom (get-pom pom-file))
-         (java-inputs (map cdr inputs))
-         (artifact (pom-artifactid pom))
-         (group (pom-groupid pom))
-         (version (pom-version pom)))
-    (let loop ((modules (pom-ref pom "modules"))
-               (local-packages
-                 (add-local-package local-packages group artifact version)))
-      (pk 'local-packages local-packages)
-      (match modules
-        (#f local-packages)
-        ('() local-packages)
-        (((? string? _) modules ...)
-         (loop modules local-packages))
-        (((_ module) modules ...)
-         (loop
-           modules
-           (fix-pom (string-append (dirname pom-file) "/" module "/pom.xml")
-                    inputs local-packages excludes)))))))
+                        #:excludes excludes))
 
 (define* (fix-pom-files #:key inputs local-packages exclude #:allow-other-keys)
-  (fix-pom "pom.xml" inputs local-packages exclude)
+  (let ((local-packages (pom-local-packages "pom.xml" #:local-packages local-packages)))
+    (format (current-error-port) "Fix pom files with local packages: ~a~%" local-packages)
+    (for-each
+      (lambda (pom)
+        (when (file-exists? pom)
+          (fix-pom pom inputs local-packages exclude)))
+      (pom-and-submodules "pom.xml")))
   #t)
 
 (define* (build #:key outputs #:allow-other-keys)
diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm
index 327d5f75e8..8f16cf4d26 100644
--- a/guix/build/maven/pom.scm
+++ b/guix/build/maven/pom.scm
@@ -21,7 +21,8 @@
   #:use-module (system foreign)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
-  #:export (get-pom
+  #:export (add-local-package
+            get-pom
             pom-ref
             pom-description
             pom-name
@@ -30,8 +31,24 @@
             pom-groupid
             pom-dependencies
             group->dir
+            pom-and-submodules
+            pom-local-packages
             fix-pom-dependencies))
 
+(define (add-local-package local-packages group artifact version)
+  "Takes @var{local-packages}, a list of local packages, and adds a new one
+for @var{group}:@var{artifact} at @var{version}."
+  (define (alist-set lst key val)
+    (match lst
+      ('() (list (cons key val)))
+      (((k . v) lst ...)
+       (if (equal? k key)
+         (cons (cons key val) lst)
+         (cons (cons k v) (alist-set lst key val))))))
+  (alist-set local-packages group
+    (alist-set (or (assoc-ref local-packages group) '()) artifact
+      version)))
+
 (define (get-pom file)
   "Return the content of a @file{.pom} file."
   (let ((pom-content (call-with-input-file file xml->sxml)))
@@ -234,6 +251,40 @@ to re-declare the namespaces in the top-level element."
                    http://maven.apache.org/xsd/maven-4.0.0.xsd"))
        ,(map fix-xml sxml)))))
 
+(define (pom-and-submodules pom-file)
+  "Given @var{pom-file}, the file name of a pom, return the list of pom file
+names that correspond to itself and its submodules, recursively."
+  (define (get-modules modules)
+    (match modules
+      (#f '())
+      ('() '())
+      (((? string? _) rest ...) (get-modules rest))
+      ((('http://maven.apache.org/POM/4.0.0:module mod) rest ...)
+       (let ((pom (string-append (dirname pom-file) "/" mod "/pom.xml")))
+         (if (file-exists? pom)
+             (cons pom (get-modules rest))
+             (get-modules rest))))))
+
+  (let* ((pom (get-pom pom-file))
+         (modules (get-modules (pom-ref pom "modules"))))
+    (cons pom-file
+          (apply append (map pom-and-submodules modules)))))
+
+(define* (pom-local-packages pom-file #:key (local-packages '()))
+  "Given @var{pom-file}, a pom file name, return a list of local packages that
+this repository contains."
+  (let loop ((modules (pom-and-submodules pom-file))
+             (local-packages local-packages))
+    (match modules
+      (() local-packages)
+      ((module modules ...)
+       (let* ((pom (get-pom module))
+              (version (pom-version pom))
+              (artifactid (pom-artifactid pom))
+              (groupid (pom-groupid pom)))
+         (loop modules
+               (add-local-package local-packages groupid artifactid version)))))))
+
 (define (group->dir group)
   "Convert a group ID to a directory path."
   (string-join (string-split group #\.) "/"))
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:03 GMT) Full text and rfc822 format available.

Message #17 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 04/14] guix: maven: Support fixing extensions.
Date: Tue,  1 Jun 2021 00:44:17 +0200
* guix/build/maven/pom.scm (fix-pom-dependencies): Add support for fixing
extension versions.
---
 guix/build/maven/pom.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm
index 8f16cf4d26..3a4ad7a216 100644
--- a/guix/build/maven/pom.scm
+++ b/guix/build/maven/pom.scm
@@ -374,8 +374,27 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
           `((http://maven.apache.org/POM/4.0.0:plugins
               ,(fix-plugins plugins))
             ,@(fix-build rest)))
+         (('http://maven.apache.org/POM/4.0.0:extensions extensions ...)
+          `((http://maven.apache.org/POM/4.0.0:extensions
+              ,(fix-extensions extensions))
+            ,@(fix-build rest)))
          (tag (cons tag (fix-build rest)))))))
 
+  (define* (fix-extensions extensions #:optional optional?)
+    (match extensions
+      ('() '())
+      ((tag rest ...)
+       (match tag
+         (('http://maven.apache.org/POM/4.0.0:extension extension ...)
+          (let ((group (or (pom-groupid extension) "org.apache.maven.plugins"))
+                (artifact (pom-artifactid extension)))
+            (if (member artifact (or (assoc-ref excludes group) '()))
+              (fix-extensions rest optional?)
+              `((http://maven.apache.org/POM/4.0.0:extension
+                  ,(fix-plugin extension optional?)); extensions are similar to plugins
+                ,@(fix-extensions rest optional?)))))
+         (tag (cons tag (fix-extensions rest optional?)))))))
+
   (define fix-management
     (match-lambda
       ('() '())
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:04 GMT) Full text and rfc822 format available.

Message #20 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 05/14] guix: maven: Support fixing modules.
Date: Tue,  1 Jun 2021 00:44:18 +0200
* guix/build/maven/pom.scm (fix-pom-dependencies): Support fixing
modules that do not exist.
* guix/build/maven-build-system.scm (fix-pom): Fix modules.
---
 guix/build/maven-build-system.scm |  1 +
 guix/build/maven/pom.scm          | 19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/guix/build/maven-build-system.scm b/guix/build/maven-build-system.scm
index 374fa2fdb8..b3d97c81ea 100644
--- a/guix/build/maven-build-system.scm
+++ b/guix/build/maven-build-system.scm
@@ -65,6 +65,7 @@
   (format #t "fixing ~a~%" pom-file)
   (fix-pom-dependencies pom-file (map cdr inputs)
                         #:with-plugins? #t #:with-build-dependencies? #t
+                        #:with-modules? #t
                         #:local-packages local-packages
                         #:excludes excludes))
 
diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm
index 3a4ad7a216..ffb4515179 100644
--- a/guix/build/maven/pom.scm
+++ b/guix/build/maven/pom.scm
@@ -291,7 +291,8 @@ this repository contains."
 
 (define* (fix-pom-dependencies pom-file inputs
                                #:key with-plugins? with-build-dependencies?
-                                     (excludes '()) (local-packages '()))
+                                     with-modules? (excludes '())
+                                     (local-packages '()))
   "Open @var{pom-file}, and override its content, rewritting its dependencies
 to set their version to the latest version available in the @var{inputs}.
 
@@ -339,8 +340,24 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
               `((http://maven.apache.org/POM/4.0.0:build ,(fix-build build))
                 ,@(fix-pom rest))
               (cons tag (fix-pom rest))))
+         (('http://maven.apache.org/POM/4.0.0:modules modules ...)
+          (if with-modules?
+              `((http://maven.apache.org/POM/4.0.0:modules ,(fix-modules modules))
+                ,@(fix-pom rest))
+              (cons tag (fix-pom rest))))
          (tag (cons tag (fix-pom rest)))))))
 
+  (define fix-modules
+    (match-lambda
+      ('() '())
+      ((tag rest ...)
+       (match tag
+        (('http://maven.apache.org/POM/4.0.0:module module)
+         (if (file-exists? (string-append (dirname pom-file) "/" module "/pom.xml"))
+             `((http://maven.apache.org/POM/4.0.0:module ,module) ,@(fix-modules rest))
+             (fix-modules rest)))
+        (tag (cons tag (fix-modules rest)))))))
+
   (define fix-dep-management
     (match-lambda
       ('() '())
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:04 GMT) Full text and rfc822 format available.

Message #23 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 06/14] guix: maven: Look in local packages when searching for
 package version.
Date: Tue,  1 Jun 2021 00:44:19 +0200
* guix/build/maven/pom.scm (fix-pom-dependencies): Also look at local
packages when looking for a package version.
---
 guix/build/maven/pom.scm | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm
index ffb4515179..9c0669c7cd 100644
--- a/guix/build/maven/pom.scm
+++ b/guix/build/maven/pom.scm
@@ -481,7 +481,7 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
               (cons `(http://maven.apache.org/POM/4.0.0:version ,version) dep)))
           dep)))
 
-  (define* (find-version inputs group artifact #:optional optional?)
+  (define (find-packaged-version inputs group artifact)
     (let* ((directory (string-append "lib/m2/" (group->dir group)
                                      "/" artifact))
            (java-inputs (filter
@@ -493,13 +493,19 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
            (versions (append-map ls java-inputs))
            (versions (sort versions version>?)))
       (if (null? versions)
-        (if optional?
           #f
-          (begin
-            (format (current-error-port) "maven: ~a:~a is missing from inputs~%"
-                    group artifact)
-            (throw 'no-such-input group artifact)))
-        (car versions))))
+          (car versions))))
+
+  (define* (find-version inputs group artifact #:optional optional?)
+    (let ((packaged-version (find-packaged-version inputs group artifact))
+          (local-version (assoc-ref (assoc-ref local-packages group) artifact)))
+      (or local-version packaged-version
+          (if optional?
+            #f
+            (begin
+              (format (current-error-port) "maven: ~a:~a is missing from inputs~%"
+                      group artifact)
+              (throw 'no-such-input group artifact))))))
 
   (let ((tmpfile (string-append pom-file ".tmp")))
     (with-output-to-file pom-file
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:05 GMT) Full text and rfc822 format available.

Message #26 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 07/14] guix: maven: Use a temporary file to fix pom files.
Date: Tue,  1 Jun 2021 00:44:20 +0200
* guix/build/maven/pom.scm (fix-pom-dependencies): Actually use the
temporary file that was created.
---
 guix/build/maven/pom.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/build/maven/pom.scm b/guix/build/maven/pom.scm
index 9c0669c7cd..9e35e47a7f 100644
--- a/guix/build/maven/pom.scm
+++ b/guix/build/maven/pom.scm
@@ -508,6 +508,7 @@ Returns nothing, but overrides the @var{pom-file} as a side-effect."
               (throw 'no-such-input group artifact))))))
 
   (let ((tmpfile (string-append pom-file ".tmp")))
-    (with-output-to-file pom-file
+    (with-output-to-file tmpfile
       (lambda _
-        (sxml->xml (fix-maven-xml (fix-pom pom)))))))
+        (sxml->xml (fix-maven-xml (fix-pom pom)))))
+    (rename-file tmpfile pom-file)))
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:05 GMT) Full text and rfc822 format available.

Message #29 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 08/14] guix: java-utils: Look for actual jar files.
Date: Tue,  1 Jun 2021 00:44:21 +0200
* guix/build/java-utils.scm (install-from-pom): Fix `find-files` to look
only for jar files.
---
 guix/build/java-utils.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/build/java-utils.scm b/guix/build/java-utils.scm
index 5a54a14c1b..87c3ac43c9 100644
--- a/guix/build/java-utils.scm
+++ b/guix/build/java-utils.scm
@@ -125,7 +125,7 @@ the phase fails."
                                                              version ".jar"))))
            ;; Otherwise, we try to find any jar file.
            (jars (if (null? jars)
-                     (find-files "." ".*.jar")
+                     (find-files "." "\\.jar$")
                      jars))
            (jar-name (string-append repository artifact "-" version ".jar"))
            (pom-name (string-append repository artifact "-" version ".pom")))
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:45:05 GMT) Full text and rfc822 format available.

Message #32 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 10/14] gnu: java-commons-math3: Install to maven repository.
Date: Tue,  1 Jun 2021 00:44:23 +0200
* gnu/packages/java.scm (java-commons-math3)[phases]: Use
install-from-pom.
---
 gnu/packages/java.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 14d02af512..dd9827a351 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -5789,7 +5789,7 @@ overly clever.")
              #t))
          ;; There is no install target.
          (replace 'install
-           (install-jars "target")))))
+           (install-from-pom "pom.xml")))))
     (native-inputs
      `(("java-junit" ,java-junit)
        ("java-hamcrest-core" ,java-hamcrest-core)))
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:46:02 GMT) Full text and rfc822 format available.

Message #35 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 09/14] gnu: Add java-jopt-simple-4.
Date: Tue,  1 Jun 2021 00:44:22 +0200
* gnu/packges/java.scm (java-jopt-simple-4): New variable.
(java-jopt-simple): Install to maven repository structure.
---
 gnu/packages/java.scm | 32 ++++++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d7118b4ce6..14d02af512 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3,7 +3,7 @@
 ;;; Copyright © 2016 Leo Famulari <leo <at> famulari.name>
 ;;; Copyright © 2016, 2017 Roel Janssen <roel <at> gnu.org>
 ;;; Copyright © 2017, 2019, 2021 Carlo Zancanaro <carlo <at> zancanaro.id.au>
-;;; Copyright © 2017-2020 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2017-2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2017 Thomas Danckaert <post <at> thomasdanckaert.be>
 ;;; Copyright © 2016, 2017, 2018 Alex Vong <alexvong1995 <at> gmail.com>
 ;;; Copyright © 2017, 2019, 2021 Tobias Geerinckx-Rice <me <at> tobias.gr>
@@ -5715,7 +5715,13 @@ The jMock library
     (build-system ant-build-system)
     (arguments
      `(#:tests? #f ; there are no tests
-       #:jar-name "jopt-simple.jar"))
+       #:jar-name "jopt-simple.jar"
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'install 'create-pom
+           (generate-pom.xml "pom.xml" "net.sf.jopt-simple" "jopt-simple" ,version))
+         (replace 'install
+           (install-from-pom "pom.xml")))))
     (home-page "https://pholser.github.io/jopt-simple/")
     (synopsis "Java library for parsing command line options")
     (description "JOpt Simple is a Java library for parsing command line
@@ -5727,6 +5733,28 @@ retrieval of options and their arguments simple and expressive, without being
 overly clever.")
     (license license:expat)))
 
+;; Required by jmh
+(define-public java-jopt-simple-4
+  (package
+    (inherit java-jopt-simple)
+    (version "4.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://repo1.maven.org/maven2/"
+                                  "net/sf/jopt-simple/jopt-simple/"
+                                  version "/jopt-simple-"
+                                  version "-sources.jar"))
+              (sha256
+               (base32
+                "0ny82zczxkn201ld0b7rps0ifzjhfs8m1ncdmy1f50145ciszkpd"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments java-jopt-simple)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'create-pom
+             (generate-pom.xml "pom.xml" "net.sf.jopt-simple" "jopt-simple"
+                               ,version))))))))
+
 (define-public java-commons-math3
   (package
     (name "java-commons-math3")
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:46:02 GMT) Full text and rfc822 format available.

Message #38 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 11/14] gnu: maven-core: Hardcode versions we have in Guix.
Date: Tue,  1 Jun 2021 00:44:24 +0200
* gnu/packages/maven.scm (maven-core)[phases]: Replace default hardcoded
versions by versions of packages we have in Guix.
---
 gnu/packages/maven.scm | 29 ++++++++++++++++++++++++++---
 1 file changed, 26 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 8f63ee9be2..9d65e9b56d 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2018 Julien Lepiller <julien <at> lepiller.eu>
+;;; Copyright © 2018-2021 Julien Lepiller <julien <at> lepiller.eu>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2019 Björn Höfling <bjoern.hoefling <at> bjoernhoefling.de>
 ;;; Copyright © 2020 Efraim Flashner <efraim <at> flashner.co.il>
@@ -1541,7 +1541,9 @@ process."))))
             (add-before 'build 'modify-metainf
               (lambda _
                 (substitute* "build.xml"
-                  (("message=\"\"") "message=\"Implementation-Version: 3.5.4\n\""))
+                  (("message=\"\"")
+                   (string-append "message=\"Implementation-Version: "
+                                  (package-version maven) "\n\"")))
                 #t))
             (add-before 'build 'add-maven-files
               (lambda _
@@ -1590,7 +1592,28 @@ artifactId=maven-core" ,(package-version maven-core-bootstrap))))
                                        default-bindings-xml
                                        artifact-handlers-xml)))))))
                 #t))
-            (add-after 'generate-metadata 'rebuild
+            (add-after 'generate-metadata 'fix-plugin-versions
+              (lambda _
+                ;; This file controls the default plugins used by Maven.  Ensure
+                ;; we use the versions we have packaged by default
+                (substitute* '("build/classes/META-INF/plexus/default-bindings.xml"
+                               "build/classes/META-INF/plexus/components.xml")
+                  (("maven-install-plugin:[0-9.]+")
+                   (string-append "maven-install-plugin:"
+                                  ,(package-version maven-install-plugin)))
+                  (("maven-resources-plugin:[0-9.]+")
+                   (string-append "maven-resources-plugin:"
+                                  ,(package-version maven-resources-plugin)))
+                  (("maven-compiler-plugin:[0-9.]+")
+                   (string-append "maven-compiler-plugin:"
+                                  ,(package-version maven-compiler-plugin)))
+                  (("maven-surefire-plugin:[0-9.]+")
+                   (string-append "maven-surefire-plugin:"
+                                  ,(package-version maven-surefire-plugin)))
+                  (("maven-jar-plugin:[0-9.]+")
+                   (string-append "maven-jar-plugin:"
+                                  ,(package-version maven-jar-plugin))))))
+            (add-after 'fix-plugin-versions 'rebuild
               (lambda _
                 (invoke "ant" "jar")
                 #t))))))
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:46:03 GMT) Full text and rfc822 format available.

Message #41 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 12/14] gnu: maven-enforcer-parent-pom: Fix pom.
Date: Tue,  1 Jun 2021 00:44:25 +0200
* gnu/packages/maven.scm (maven-enforcer-parent-pom): Fix dependency
versions in pom file.
---
 gnu/packages/maven.scm | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 9d65e9b56d..f7cb168f47 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -2713,6 +2713,15 @@ Maven project dependencies.")
        (modify-phases %standard-phases
          (delete 'configure)
          (delete 'build)
+         (add-before 'install 'fix-pom-versions
+           (lambda _
+             (substitute* "pom.xml"
+               (("3.8.1") ,(package-version java-commons-lang3))
+               (("1.4.1") ,(package-version maven-resolver-util))
+               (("1.12") ,(package-version java-commons-codec))
+               (("<version>2.2</version>")
+                ,(string-append "<version>" (package-version maven-dependency-tree)
+                                "</version>")))))
          (replace 'install
            (install-pom-file "pom.xml")))))
     (propagated-inputs
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:46:03 GMT) Full text and rfc822 format available.

Message #44 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 13/14] gnu: java-jmh: Update to 1.32.
Date: Tue,  1 Jun 2021 00:44:26 +0200
* gnu/packages/java.scm (java-jmh): Update to 1.32.
[source]: Switch to the git repository.
---
 gnu/packages/java.scm | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index dd9827a351..c7ae002736 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -5803,16 +5803,16 @@ available in the Java programming language or Commons Lang.")
 (define-public java-jmh
   (package
     (name "java-jmh")
-    (version "1.17.5")
+    (version "1.32")
     (source (origin
-              (method hg-fetch)
-              (uri (hg-reference
-                    (url "http://hg.openjdk.java.net/code-tools/jmh/")
-                    (changeset version)))
-              (file-name (string-append name "-" version "-checkout"))
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/openjdk/jmh")
+                    (commit version)))
+              (file-name (git-file-name name version))
               (sha256
                (base32
-                "1fxyxhg9famwcg1prc4cgwb5wzyxqavn3cjm5vz8605xz7x5k084"))))
+                "0i7fa7l3gdqkkgz5ddayp6m46dgbj9rqlz35xffrcbyiz3gpljy0"))))
     (build-system ant-build-system)
     (arguments
      `(#:jar-name "jmh-core.jar"
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48766; Package guix-patches. (Mon, 31 May 2021 22:46:03 GMT) Full text and rfc822 format available.

Message #47 received at 48766 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766 <at> debbugs.gnu.org
Subject: [PATCH 14/14] gnu: java-jmh: Switch to maven-build-system.
Date: Tue,  1 Jun 2021 00:44:27 +0200
* gnu/packages/java.scm (java-jmh): Switch to maven-build-system.
---
 gnu/packages/java.scm | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index c7ae002736..f597c64811 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -43,6 +43,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system ant)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system maven)
   #:use-module (guix build-system trivial)
   #:use-module (gnu packages)
   #:use-module (gnu packages attr)
@@ -5813,26 +5814,27 @@ available in the Java programming language or Commons Lang.")
               (sha256
                (base32
                 "0i7fa7l3gdqkkgz5ddayp6m46dgbj9rqlz35xffrcbyiz3gpljy0"))))
-    (build-system ant-build-system)
+    (build-system maven-build-system)
     (arguments
-     `(#:jar-name "jmh-core.jar"
-       #:source-dir "jmh-core/src/main"
-       #:test-dir "jmh-core/src/test"
+     `(#:exclude
+       (("org.apache.maven.plugins" .
+         ("maven-source-plugin" "maven-archetype-plugin" "maven-shade-plugin"
+          "maven-site-plugin" "maven-javadoc-plugin" "maven-eclipse-plugin"))
+        ("com.mycila.maven-license-plugin" . ("maven-license-plugin"))
+        ("org.apache.maven.wagon" . ("wagon-ssh")))
+       #:maven-plugins
+       (("maven-enforcer-plugin" ,maven-enforcer-plugin)
+        ,@(default-maven-plugins))
        #:phases
        (modify-phases %standard-phases
-         ;; This seems to be a bug in the JDK.  It may not be necessary in
-         ;; future versions of the JDK.
-         (add-after 'unpack 'fix-bug
+         (add-after 'unpack 'remove-unnecessary
            (lambda _
-             (with-directory-excursion
-                 "jmh-core/src/main/java/org/openjdk/jmh/runner/options"
-               (substitute* '("IntegerValueConverter.java"
-                              "ThreadsValueConverter.java")
-                 (("public Class<Integer> valueType")
-                  "public Class<? extends Integer> valueType")))
-             #t)))))
-    (inputs
-     `(("java-jopt-simple" ,java-jopt-simple)
+             ;; requires org.apache.maven.archetype:archetype-packaging.
+             ;; Its subprojects also require groovy, kotlin and scala,
+             ;; respectively.
+             (delete-file-recursively "jmh-archetypes"))))))
+    (propagated-inputs
+     `(("java-jopt-simple" ,java-jopt-simple-4)
        ("java-commons-math3" ,java-commons-math3)))
     (native-inputs
      `(("java-junit" ,java-junit)
-- 
2.31.1





Reply sent to Julien Lepiller <julien <at> lepiller.eu>:
You have taken responsibility. (Tue, 22 Jun 2021 11:14:01 GMT) Full text and rfc822 format available.

Notification sent to Julien Lepiller <julien <at> lepiller.eu>:
bug acknowledged by developer. (Tue, 22 Jun 2021 11:14:01 GMT) Full text and rfc822 format available.

Message #52 received at 48766-done <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 48766-done <at> debbugs.gnu.org
Subject: Re: [bug#48766] [PATCH] gnu: java-jmh: Switch to maven-build-system.
Date: Tue, 22 Jun 2021 13:13:31 +0200
After almost a month of silence, pushed to master as
4c98db94b0271aa5371ff00cf98c0ebc70ab1a8d to
1b1eeb3b123162c4d73c939e9ca7bbbb4f79aef1. Thanks!




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 20 Jul 2021 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.