From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SIL4LfVmtWA3PAAAgWs5BA (envelope-from ) for ; Tue, 01 Jun 2021 00:45:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id iHlwKfVmtWAbPwAA1q6Kng (envelope-from ) for ; Mon, 31 May 2021 22:45:09 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5BC5727954 for ; Tue, 1 Jun 2021 00:45:09 +0200 (CEST) Received: from localhost ([::1]:50320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnqei-0006Dl-CW for larch@yhetil.org; Mon, 31 May 2021 18:45:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnqec-0006D0-HG for guix-patches@gnu.org; Mon, 31 May 2021 18:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:51861) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnqec-0007SL-9B for guix-patches@gnu.org; Mon, 31 May 2021 18:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnqec-000404-7C for guix-patches@gnu.org; Mon, 31 May 2021 18:45:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48766] [PATCH 01/14] guix: java-utils: Factorize pom.xml generation. Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 May 2021 22:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48766 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48766@debbugs.gnu.org Received: via spool by 48766-submit@debbugs.gnu.org id=B48766.162250108215247 (code B ref 48766); Mon, 31 May 2021 22:45:02 +0000 Received: (at 48766) by debbugs.gnu.org; 31 May 2021 22:44:42 +0000 Received: from localhost ([127.0.0.1]:35153 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnqeH-0003xl-Fi for submit@debbugs.gnu.org; Mon, 31 May 2021 18:44:42 -0400 Received: from lepiller.eu ([89.234.186.109]:38956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnqeE-0003xU-IO for 48766@debbugs.gnu.org; Mon, 31 May 2021 18:44:39 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id d129670f for <48766@debbugs.gnu.org>; Mon, 31 May 2021 22:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=dkim; bh=i7rvmpP/Dgx5CKG3H5DCx3U9c Q9iuqG43Mudu0GlC7w=; b=h2ijERO7SMvVxLwdLj3g9Nm6yKrT9RpuMX8yMjV18 OV60MYpJiP4c9OlxYPgj+aTzixXnxKyWo6FAjnVNDNlSC5ZzmRjuTU40eNSNSGjr U4WoT6SP4XawDou3ucp+i47QSMFTb+opS1md0yg6wZ/mx5bGMpEqydw30IFFEcSg O+xoVzsYqlQ2Ay4yWcTik66n+GQQtKpQyfIrTn/uzEdrUJxJjpEjDBS+TWdnntY1 xBJJq69ku8HWJltewr3f/4vjkFilN7Z1phw6v/cW8ZvfEaF+opI/S14f2ld31BmC gnvupRFq49AT16Iuh32CXqML0hOOy+QD66jmvORco4ZUQ== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id c06cd71f (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <48766@debbugs.gnu.org>; Mon, 31 May 2021 22:44:36 +0000 (UTC) From: Julien Lepiller Date: Tue, 1 Jun 2021 00:44:14 +0200 Message-Id: <20210531224427.13300-1-julien@lepiller.eu> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210601004100.69baa2d0@tachikoma.lepiller.eu> References: <20210601004100.69baa2d0@tachikoma.lepiller.eu> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622501109; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=SOAoSfDENrfv8Ai69PhsHYglk2RQFqTT21Ki2vDgZdQ=; b=gYaIFSYjgAlVToe5e414BvxbKiEw/zBJ3oGPxzY1jlRmeHnOC3eYW6+CqkJGmUyqkWpZ2g 62YFEzgT1jTmkPOH1U9xYczInw6TFa/Q0xuzGU17pm9/KqqQnIpygX05vgnPmdtXQYKlu4 3ACgqWPYNgaORIUKgoVjHZamUXekwvalK9m1y8eedVOQbcAxJUqcgVlErIu/gn8+y58HbO M9Qe7bvwWnsosww/ah7sSGRkKorXGIOITkr5x5jr/uLk9Ld5kkwENNlDx37ROgRWnBCZXF i+alQ1ixXkaXi05+znEueOci45fQj+mQSkSUN/+wAjpHxVuenyKYRNLGsaBCVg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622501109; a=rsa-sha256; cv=none; b=iHxOYTvcVq7eLNBC6sNdr98uIWxcwmyOFMNYj6IIAI5+lvRgGknURl2cFrmGmKl5i9rRb4 7YPnWlLBMB6nwc/NkrRgdYIhMdm81kHCRAF3LqOehqIkl2rEO//Dyy1boXnmlxP1jQ1Qfd Xi0FuTIUZl+zEVsO7zK/QuiuGZkiMtK/YYstoEjLNSvu3cC2quizgjrRTCYUOAfb5YMMBw 5nvMdyq32nm+h8MFAGSZKuAk1FXD8pOB5TKR5bZtZTrDr7d2a5lQ7AlaRDiOi/ofFT1Fov YNkm8Z/7ZwHV1J+LUMpTB8YpAbeeTRsGCOdWzw1kcikeDhAZajQjhj+olc9d9Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=h2ijERO7; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: 3.67 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=h2ijERO7; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 5BC5727954 X-Spam-Score: 3.67 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2DH+DdNhjr6I * 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