summaryrefslogtreecommitdiff
path: root/guix/build
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 /guix/build
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 'guix/build')
-rw-r--r--guix/build/java-utils.scm29
1 files changed, 29 insertions, 0 deletions
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)))))))))