summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2021-06-01 00:44:14 +0200
committerJulien Lepiller <julien@lepiller.eu>2021-06-22 13:09:41 +0200
commit4c98db94b0271aa5371ff00cf98c0ebc70ab1a8d (patch)
treeeff6c5d752d5e34f69a80a2ff90733d9af53cca8 /gnu
parenta40207bd6f27d5cfb880974b196606631efa9b4e (diff)
guix: java-utils: Factorize pom.xml generation.
* 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.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/java.scm117
-rw-r--r--gnu/packages/maven.scm28
2 files changed, 29 insertions, 116 deletions
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 471cc5e906..59f9497ec2 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3847,25 +3847,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")
@@ -3891,7 +3877,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
@@ -6463,25 +6456,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")
@@ -6510,25 +6489,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/")
@@ -10559,25 +10523,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")
@@ -12176,29 +12125,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
@@ -12230,11 +12164,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,
@@ -12242,18 +12171,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")