all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Julien Lepiller <julien@lepiller.eu>
To: 31774@debbugs.gnu.org
Subject: [bug#31774] [PATCH 12/22] gnu: Add maven-core.
Date: Sun, 10 Jun 2018 20:46:35 +0200	[thread overview]
Message-ID: <20180610204631.62f0ea79@lepiller.eu> (raw)
In-Reply-To: <20180610191643.15f8a63e@scratchpost.org>

[-- Attachment #1: Type: text/plain, Size: 1994 bytes --]

Le Sun, 10 Jun 2018 19:16:43 +0200,
Danny Milosavljevic <dannym@scratchpost.org> a écrit :

> Hi Julien,
> 
> On Sun, 10 Jun 2018 13:03:09 +0200
> Julien Lepiller <julien@lepiller.eu> wrote:
> 
> > +                ;; FIXME: This should be taken care of by
> > plexus-component-metadata directly  
> 
> Is this possible now?
> 
> > +                (invoke "sh" "-c"
> > +                        (string-append
> > +                          "(cat
> > build/classes/META-INF/plexus/components.t.xml |"
> > +                          "sed -e 's|</component-set>||' -e
> > 's|</components>||' ; "
> > +                          "cat
> > src/main/resources/META-INF/plexus/artifact-handlers.xml |"
> > +                          " sed -e 's|<?xml.*||' -e
> > 's|<component-set>||' -e 's|<components>||'"
> > +                          " -e 's|</component-set>||' -e
> > 's|</components>||'; "
> > +                          "cat
> > src/main/resources/META-INF/plexus/components.xml |"
> > +                          " sed -e 's|<?xml.*||' -e
> > 's|<component-set>||' -e 's|<components>||'"
> > +                          " -e 's|</component-set>||' -e
> > 's|</components>||'; "
> > +                          "cat
> > src/main/resources/META-INF/plexus/default-bindings.xml |"
> > +                          " sed -e 's|<?xml.*||' -e
> > 's|<component-set>||' -e 's|<components>||' )>"
> > +
> > "build/classes/META-INF/plexus/components.xml"))  
> 
> XML isn't really line-based, so using (sxml simple) to merge would be
> more reliable. Error reporting would be better, too.
> 
> https://www.gnu.org/software/guile/manual/html_node/Reading-and-Writing-XML.html#Reading-and-Writing-XML

So I tried to use that, and here is an updated patch. I had troubles
using match (it tried to evaluate the content of the list I wanted to
match with, although that doesn't happen at the REPL), so I used a
sequence of cdr/car instead. Thanks for the hint :)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0012-gnu-Add-maven-core.patch --]
[-- Type: text/x-patch, Size: 4421 bytes --]

From d459a72a474e6b241c864b8c9390f4c9de18d93e Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Sat, 17 Mar 2018 16:34:46 +0100
Subject: [PATCH 12/22] gnu: Add maven-core.

* gnu/packages/maven.scm (maven-core): New variable.
---
 gnu/packages/maven.scm | 66 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index dff5bd3e4..029c68b38 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -752,3 +752,69 @@ so really just plain objects.")))
        ("java-junit" ,java-junit)
        ("java-mockito-1" ,java-mockito-1)
        ("java-commons-jxpath" ,java-commons-jxpath)))))
+
+(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>.
+                    (cdr (car (cdr (car (cdr (cdr sxml))))))))
+                (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 (sxml->string
+                                 `(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)))))
-- 
2.17.1


  reply	other threads:[~2018-06-10 18:47 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-10 11:01 [bug#31774] [PATCH] Add maven Julien Lepiller
2018-06-10 11:02 ` [bug#31774] [PATCH 01/22] gnu: Add java-eclipse-jetty-xml Julien Lepiller
2018-06-10 11:02   ` [bug#31774] [PATCH 02/22] gnu: java-eclipse-jetty-security-9.2: Ignore test error Julien Lepiller
2018-06-10 15:14     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 03/22] gnu. Add java-eclipse-jetty-xml-9.2 Julien Lepiller
2018-06-10 15:15     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 04/22] gnu: Add java-eclipse-jetty-webapp Julien Lepiller
2018-06-10 15:16     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 05/22] gnu: Add java-eclipse-jetty-webapp-9.2 Julien Lepiller
2018-06-10 15:35     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 06/22] gnu: Add java-plexus-cli Julien Lepiller
2018-06-10 15:17     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 07/22] gnu: Add java-qdox Julien Lepiller
2018-06-10 15:19     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 08/22] gnu: Add maven-plugin-api Julien Lepiller
2018-06-10 17:06     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 09/22] gnu: Add maven-core-bootstrap Julien Lepiller
2018-06-10 15:20     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 10/22] gnu: Add maven-plugin-annotations Julien Lepiller
2018-06-10 15:20     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 11/22] gnu: Add java-plexus-component-metadata Julien Lepiller
2018-06-10 15:21     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 12/22] gnu: Add maven-core Julien Lepiller
2018-06-10 17:16     ` Danny Milosavljevic
2018-06-10 18:46       ` Julien Lepiller [this message]
2018-06-11 18:43         ` Danny Milosavljevic
2018-06-12 19:36           ` Julien Lepiller
2018-06-14  0:13             ` Danny Milosavljevic
2018-06-14 20:07               ` Ludovic Courtès
2018-06-14  0:18             ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 13/22] gnu: Add maven-embedder Julien Lepiller
2018-06-10 15:22     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 14/22] gnu: Add maven-wagon-provider-api Julien Lepiller
2018-06-10 15:22     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 15/22] gnu: Add maven-wagon-provider-test Julien Lepiller
2018-06-10 15:23     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 16/22] gnu: Add maven-wagon-file Julien Lepiller
2018-06-10 15:24     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 17/22] gnu: Add maven-wagon-tck-http Julien Lepiller
2018-06-10 15:24     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 18/22] gnu: Add maven-wagon-http-shared Julien Lepiller
2018-06-10 15:33     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 19/22] gnu: Add maven-wagon-http Julien Lepiller
2018-06-10 13:16     ` Danny Milosavljevic
2018-06-10 15:29       ` Danny Milosavljevic
2018-06-10 16:38         ` Julien Lepiller
2018-06-10 11:03   ` [bug#31774] [PATCH 20/22] gnu: Add maven-resolver-transport-wagon Julien Lepiller
2018-06-10 11:03   ` [bug#31774] [PATCH 21/22] gnu: Add maven-compat Julien Lepiller
2018-06-10 15:32     ` Danny Milosavljevic
2018-06-10 11:03   ` [bug#31774] [PATCH 22/22] gnu: Add maven Julien Lepiller
2018-06-10 15:39     ` Danny Milosavljevic
2018-06-11  1:44     ` Marius Bakke
2018-06-16 11:21 ` bug#31774: [PATCH] " Julien Lepiller
2018-06-16 16:16   ` [bug#31774] " Ludovic Courtès
2018-06-22 21:21   ` Björn Höfling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180610204631.62f0ea79@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=31774@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.