* 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(-)
Toggle diff (280 lines)
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.")
- ((guix build ant-build-system)
- (guix build java-utils)
(modify-phases %standard-phases
(add-before 'install 'create-pom
- (with-output-to-file "pom.xml"
- (groupId "com.thoughtworks.qdox")
- (version ,,version))))))
+ (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version
(install-from-pom "pom.xml")))))
(home-page "https://github.com/codehaus/qdox")
@@ -3825,7 +3811,14 @@ documentation tools.")
"/qdox-" version "-sources.jar"))
- "1s2jnmx2dkwnaha12lcj26aynywgwa8sslc47z82wx8xai13y4fg"))))))
+ "1s2jnmx2dkwnaha12lcj26aynywgwa8sslc47z82wx8xai13y4fg"))))
+ (substitute-keyword-arguments (package-arguments java-qdox)
+ `(modify-phases ,phases
+ (generate-pom.xml "pom.xml" "com.thoughtworks.qdox" "qdox" ,version
(define-public java-jarjar
@@ -6397,25 +6390,11 @@ bottlenecks move away from the database in an effectively cached system.")
`(#:tests? #f ; no tests included
- #:modules ((guix build ant-build-system)
- (guix build java-utils)
(modify-phases %standard-phases
(add-before 'install 'create-pom
- (with-output-to-file "pom.xml"
- (groupId "javax.annotation")
- (artifactId "jsr250-api")
- (version ,,version))))))
+ (generate-pom.xml "pom.xml" "javax.annotation" "jsr250-api" ,version
(install-from-pom "pom.xml")))))
(home-page "https://jcp.org/en/jsr/detail?id=250")
@@ -6444,25 +6423,10 @@ namespaces.")
`(#:tests? #f ; no tests included
- #:modules ((guix build ant-build-system)
- (guix build java-utils)
(modify-phases %standard-phases
(add-before 'install 'create-pom
- (with-output-to-file "pom.xml"
- (groupId "com.google.code.findbugs")
- (version ,,version))))))
+ (generate-pom.xml "pom.xml" "com.google.code.findbugs" "jsr305" ,version))
(install-from-pom "pom.xml")))))
(home-page "http://findbugs.sourceforge.net/")
@@ -10493,25 +10457,10 @@ this is not a static analysis tool.)")
#:source-dir "aopalliance/src/main"
- #:modules ((guix build ant-build-system)
- (guix build java-utils)
(modify-phases %standard-phases
(add-before 'install 'create-pom
- (with-output-to-file "pom.xml"
- (groupId "aopalliance")
- (artifactId "aopalliance")
+ (generate-pom.xml "pom.xml" "aopalliance" "aopalliance" ,version))
(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)
`(#:jar-name "java-jboss-el-api_spec.jar"
- #:modules ((guix build ant-build-system)
- (guix build java-utils)
(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
- (delete-file "pom.xml")
- (with-output-to-file "pom.xml"
- (artifactId "javax.el-api")
+ (generate-pom.xml "pom.xml" "javax.el" "javax.el-api" "3.0"
(install-from-pom "pom.xml")))))
@@ -12164,11 +12098,6 @@ JavaServer Pages (JSP).")
- #:modules ((guix build ant-build-system)
- (guix build java-utils)
(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
(add-before 'install 'override-pom
- (delete-file "pom.xml")
- (with-output-to-file "pom.xml"
- (name "interceptor-api")
- (groupId "javax.interceptor")
- (artifactId "javax.interceptor-api")
+ (generate-pom.xml "pom.xml" "javax.interceptor" "javax.interceptor-api"
+ "3.0" #:name "interceptor-api"))
(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.")))
(modify-phases %standard-phases
(add-before 'install 'regenerate-own-pom
- ;; 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"
- (name "Surefire JUnit4")
- (groupId "org.apache.maven.surefire")
- (artifactId "surefire-junit4")
- (version ,,(package-version java-surefire-common-java5)))))))
+ ;; 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.
+ "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
(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
#:use-module (sxml simple)
#:export (ant-build-javadoc
@@ -206,3 +207,31 @@ recognize the package as a plugin, and find the entry points in the plugin."
+(define* (generate-pom.xml pom-file groupid artifactid version
+ #:key (dependencies '())
+ "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."
+ (mkdir-p (dirname pom-file))
+ (with-output-to-file pom-file
+ (artifactId ,artifactid)
+ ((groupid artifactid version)
+ (artifactId ,artifactid)