From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35358) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fS5Mo-0002rC-Ru for guix-patches@gnu.org; Sun, 10 Jun 2018 14:47:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fS5Mk-0005y3-Tq for guix-patches@gnu.org; Sun, 10 Jun 2018 14:47:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:34654) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fS5Mk-0005xd-Ml for guix-patches@gnu.org; Sun, 10 Jun 2018 14:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fS5Mk-0001FY-82 for guix-patches@gnu.org; Sun, 10 Jun 2018 14:47:02 -0400 Subject: [bug#31774] [PATCH 12/22] gnu: Add maven-core. Resent-Message-ID: Date: Sun, 10 Jun 2018 20:46:35 +0200 From: Julien Lepiller Message-ID: <20180610204631.62f0ea79@lepiller.eu> In-Reply-To: <20180610191643.15f8a63e@scratchpost.org> References: <20180610130104.2b154715@lepiller.eu> <20180610110319.24043-1-julien@lepiller.eu> <20180610110319.24043-12-julien@lepiller.eu> <20180610191643.15f8a63e@scratchpost.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/c2JZrQ0.J43FQI8F4dJ6N9M" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31774@debbugs.gnu.org --MP_/c2JZrQ0.J43FQI8F4dJ6N9M Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Sun, 10 Jun 2018 19:16:43 +0200, Danny Milosavljevic a =C3=A9crit : > Hi Julien, >=20 > On Sun, 10 Jun 2018 13:03:09 +0200 > Julien Lepiller wrote: >=20 > > + ;; FIXME: This should be taken care of by > > plexus-component-metadata directly =20 >=20 > Is this possible now? >=20 > > + (invoke "sh" "-c" > > + (string-append > > + "(cat > > build/classes/META-INF/plexus/components.t.xml |" > > + "sed -e 's|||' -e > > 's|||' ; " > > + "cat > > src/main/resources/META-INF/plexus/artifact-handlers.xml |" > > + " sed -e 's| > 's|||' -e 's|||'" > > + " -e 's|||' -e > > 's|||'; " > > + "cat > > src/main/resources/META-INF/plexus/components.xml |" > > + " sed -e 's| > 's|||' -e 's|||'" > > + " -e 's|||' -e > > 's|||'; " > > + "cat > > src/main/resources/META-INF/plexus/default-bindings.xml |" > > + " sed -e 's| > 's|||' -e 's|||' )>" > > + > > "build/classes/META-INF/plexus/components.xml")) =20 >=20 > XML isn't really line-based, so using (sxml simple) to merge would be > more reliable. Error reporting would be better, too. >=20 > https://www.gnu.org/software/guile/manual/html_node/Reading-and-Writing-X= ML.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 :) --MP_/c2JZrQ0.J43FQI8F4dJ6N9M Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0012-gnu-Add-maven-core.patch =46rom d459a72a474e6b241c864b8c9390f4c9de18d93e Mon Sep 17 00:00:00 2001 From: Julien Lepiller 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-bootstra= p) + ((#:phases phases) + `(modify-phases ,phases + (add-before 'build 'modify-metainf + (lambda _ + (substitute* "build.xml" + (("message=3D\"\"") "message=3D\"Implementation-Version:= 3.5.3\n\"")) + #t)) + (add-before 'build 'add-maven-files + (lambda _ + (mkdir-p "build/classes/META-INF/maven/org.apache.maven/ma= ven-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.apa= che.maven/maven-core/pom.properties" + (lambda _ + (format #t "version=3D~a~% +groupId=3Dorg.apache.maven~% +artifactId=3Dmaven-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 s inside the + ;; and . + (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.PlexusMetadataGenera= torCli" + "--source" "build/classes/META-INF/plexus" + "--output" "build/classes/META-INF/plexus/componen= ts.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/p= lexus/components.t.xml")) + (components-xml (components "src/main/resources/META= -INF/plexus/components.xml")) + (default-bindings-xml (components "src/main/resource= s/META-INF/plexus/default-bindings.xml")) + (artifact-handlers-xml (components "src/main/resourc= es/META-INF/plexus/artifact-handlers.xml"))) + (with-output-to-file "build/classes/META-INF/plexus/comp= onents.xml" + (lambda _ + (display (sxml->string + `(component-set + (components + ,@(append generated-xml components-x= ml + 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))))) --=20 2.17.1 --MP_/c2JZrQ0.J43FQI8F4dJ6N9M--