summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2018-03-17 16:34:46 +0100
committerJulien Lepiller <julien@lepiller.eu>2018-06-16 13:18:00 +0200
commitb822544cfeb450e8fd4ead86fd0a7451db9ac859 (patch)
tree20206bcf2c0f382942ddf53623d0c4532234ef74 /gnu
parent9f25cba65af3f71b429fe3e2ddba5becc07a66f1 (diff)
downloadguix-b822544cfeb450e8fd4ead86fd0a7451db9ac859.tar.gz
gnu: Add maven-core.
* gnu/packages/maven.scm (maven-core): New variable.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/maven.scm72
1 files changed, 72 insertions, 0 deletions
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 8b69f16314..aa6c196a2b 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -767,3 +767,75 @@ generally generated from plugin sources using maven-plugin-plugin.")))
     (description "Apache Maven is a software project management and comprehension
 tool.  This package contains the maven core classes managing the whole build
 process.")))
+
+(define-public maven-core
+  (package
+    (inherit maven-core-bootstrap)
+    (arguments
+      (substitute-keyword-arguments (package-arguments maven-core-bootstrap)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (add-before 'build 'modify-metainf
+              (lambda _
+                (substitute* "build.xml"
+                  (("message=\"\"") "message=\"Implementation-Version: 3.5.3\n\""))
+                #t))
+            (add-before 'build 'add-maven-files
+              (lambda _
+                (mkdir-p "build/classes/META-INF/maven/org.apache.maven/maven-core")
+                (copy-file "pom.xml"
+                           "build/classes/META-INF/maven/org.apache.maven/maven-core/pom.xml")
+                (with-output-to-file "build/classes/META-INF/maven/org.apache.maven/maven-core/pom.properties"
+                  (lambda _
+                    (format #t "version=~a~%
+groupId=org.apache.maven~%
+artifactId=maven-core" ,(package-version maven-core-bootstrap))))
+                #t))
+            (add-after 'build 'generate-metadata
+              (lambda _
+                (define (components file)
+                  (let ((sxml (with-input-from-file file
+                                (lambda _ (xml->sxml (current-input-port)
+                                                     #:trim-whitespace? #t)))))
+                    ;; Select the list of <component>s inside the <component-set>
+                    ;; and <components>.
+                    ((@ (ice-9 match) match) sxml
+                     (('*TOP*
+                       ('*PI* foo ...)
+                       ('component-set
+                        ('components x ...))) x))))
+                (use-modules (sxml simple))
+                (delete-file "build/classes/META-INF/plexus/components.xml")
+                (invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes")
+                        "org.codehaus.plexus.metadata.PlexusMetadataGeneratorCli"
+                        "--source" "build/classes/META-INF/plexus"
+                        "--output" "build/classes/META-INF/plexus/components.t.xml"
+                        "--classes" "build/classes"
+                        "--descriptors" "build/classes")
+                ;; Now we merge all other components from hand-written xml
+                (let ((generated-xml (components "build/classes/META-INF/plexus/components.t.xml"))
+                      (components-xml (components "src/main/resources/META-INF/plexus/components.xml"))
+                      (default-bindings-xml (components "src/main/resources/META-INF/plexus/default-bindings.xml"))
+                      (artifact-handlers-xml (components "src/main/resources/META-INF/plexus/artifact-handlers.xml")))
+                  (with-output-to-file "build/classes/META-INF/plexus/components.xml"
+                    (lambda _
+                      (display "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+                      (sxml->xml
+                        `(component-set
+                           (components
+                             ,@(append generated-xml components-xml
+                                       default-bindings-xml
+                                       artifact-handlers-xml)))))))
+                #t))
+            (add-after 'generate-metadata 'rebuild
+              (lambda _
+                (invoke "ant" "jar")
+                #t))))))
+    (native-inputs
+     `(("java-plexus-component-metadata" ,java-plexus-component-metadata)
+       ("java-commons-cli" ,java-commons-cli)
+       ("java-plexus-cli" ,java-plexus-cli)
+       ("java-jdom2" ,java-jdom2)
+       ("java-qdox" ,java-qdox)
+       ("maven-core-boot" ,maven-core-bootstrap)
+       ,@(package-native-inputs maven-core-bootstrap)))))