all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
To: 56054@debbugs.gnu.org
Subject: [bug#56054] [PATCH] gnu: Add maven-shared-invoker
Date: Sat, 18 Jun 2022 17:58:12 +0300	[thread overview]
Message-ID: <87a6aavx17.fsf@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 88 bytes --]

Hello,

this patch adds Apache Maven Invoker[1] under the name
'maven-shared-invoker'.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-gnu-Add-maven-shared-invoker.patch --]
[-- Type: text/x-diff, Size: 12523 bytes --]

From bc84964c765656cd53bc85345b30d780157818dc Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Sat, 18 Jun 2022 17:05:36 +0300
Subject: [PATCH] gnu: Add maven-shared-invoker

* gnu/packages/maven.scm (maven-shared-invoker): New variable.
* gnu/packages/patches/maven-shared-invoker-exception-handler-fix.patch,
  gnu/packages/patches/maven-shared-invoker-rename-test-classes.patch: Add to
  the repository.
* gnu/local.mk (dist_patch_DATA): Add new Maven shared invoker patches.
---
 gnu/local.mk                                  |   2 +
 gnu/packages/maven.scm                        |  37 +++++
 ...shared-invoker-exception-handler-fix.patch |  28 ++++
 ...n-shared-invoker-rename-test-classes.patch | 126 ++++++++++++++++++
 4 files changed, 193 insertions(+)
 create mode 100644 gnu/packages/patches/maven-shared-invoker-exception-handler-fix.patch
 create mode 100644 gnu/packages/patches/maven-shared-invoker-rename-test-classes.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 0176585485..6d7aafb848 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1479,6 +1479,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/maxima-defsystem-mkdir.patch		\
   %D%/packages/patches/maven-generate-component-xml.patch		\
   %D%/packages/patches/maven-generate-javax-inject-named.patch		\
+  %D%/packages/patches/maven-shared-invoker-exception-handler-fix.patch	\
+  %D%/packages/patches/maven-shared-invoker-rename-test-classes.patch	\
   %D%/packages/patches/mcrypt-CVE-2012-4409.patch			\
   %D%/packages/patches/mcrypt-CVE-2012-4426.patch			\
   %D%/packages/patches/mcrypt-CVE-2012-4527.patch			\
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index 817fee1c71..57f469ed5d 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -765,6 +765,43 @@ plexus-utils in Maven.  It is not a 100% API compatible replacement but a
 replacement with improvements.")
     (license license:asl2.0)))
 
+(define-public maven-shared-invoker
+  (package
+    (name "maven-shared-invoker")
+    (version "3.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://apache/maven/shared/"
+                                  "maven-invoker-" version "-source-release.zip"))
+              (sha256
+               (base32
+                "0yhgxvwpmyfhqaksdfmj9c4ml4pj60gnin8bq1a92ximf1dyyjyc"))
+              (patches
+               (search-patches
+                "maven-shared-invoker-exception-handler-fix.patch"
+                "maven-shared-invoker-rename-test-classes.patch"))))
+    (build-system ant-build-system)
+    (arguments
+     `(#:jar-name "maven-shared-invoker.jar"
+       #:source-dir "src/main/java"
+       #:tests? #f))                      ; Tests require Maven itself
+    (propagated-inputs
+     (list maven-parent-pom-35))
+    (native-inputs
+     (list unzip
+           maven-surefire-plugin
+           java-javax-inject
+           java-junit))
+    (home-page "https://maven.apache.org/shared/maven-invoker/index.html")
+    (synopsis "Invoke Maven programmatically")
+    (description "The API of this module is concerned with firing a Maven
+build in a new JVM.  It accomplishes its task by building up a conventional
+Maven command line from options given in the current request, along with those
+global options specified in the invoker itself.  Once it has the command line,
+the invoker will execute it, and capture the resulting exit code or any
+exception thrown to signal a failure to execute.")
+    (license license:asl2.0)))
+
 (define-public maven-plugin-annotations
   (package
     (name "maven-plugin-annotations")
diff --git a/gnu/packages/patches/maven-shared-invoker-exception-handler-fix.patch b/gnu/packages/patches/maven-shared-invoker-exception-handler-fix.patch
new file mode 100644
index 0000000000..eb572f7c26
--- /dev/null
+++ b/gnu/packages/patches/maven-shared-invoker-exception-handler-fix.patch
@@ -0,0 +1,28 @@
+From 30e9cde32c1e2513ca1f656fa5043c05935f2645 Mon Sep 17 00:00:00 2001
+From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
+Date: Tue, 14 Jun 2022 23:53:13 +0300
+Subject: [PATCH 1/2] MavenCommandLineBuilder: Fix exception handling
+
+* src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
+  (setGoals): Catch 'Exception' instead of 'CommandLineException' as
+  'CommandLineException' is never thrown in the "try" block.
+---
+ .../apache/maven/shared/invoker/MavenCommandLineBuilder.java    | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java b/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
+index 7c7e985..eaf8333 100644
+--- a/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
++++ b/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
+@@ -257,7 +257,7 @@ public class MavenCommandLineBuilder
+             {
+                 cli.createArg().setLine( StringUtils.join( goals.iterator(), " " ) );
+             }
+-            catch ( CommandLineException e )
++            catch ( Exception e )
+             {
+                 throw new CommandLineConfigurationException( "Problem to set goals: " + e.getMessage(), e );
+             }
+-- 
+2.25.1
+
diff --git a/gnu/packages/patches/maven-shared-invoker-rename-test-classes.patch b/gnu/packages/patches/maven-shared-invoker-rename-test-classes.patch
new file mode 100644
index 0000000000..7ffb6fed9b
--- /dev/null
+++ b/gnu/packages/patches/maven-shared-invoker-rename-test-classes.patch
@@ -0,0 +1,126 @@
+From 4bce3183b25c44ab406c2f4d8541a0a520b15a3d Mon Sep 17 00:00:00 2001
+From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
+Date: Wed, 15 Jun 2022 07:09:29 +0300
+Subject: [PATCH 2/2] test: Rename some classes to avoid name conflicts
+
+* src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/App.java:
+  Rename to
+  "src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/AppTimeout.java"
+* src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java
+  Rename to
+  "src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTimeoutTest.java"
+* src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppTest.java:
+  Rename to
+  "src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppShouldSucceedTest.java"
+* src/test/resources/test-build-should-succeed/src/main/java/org/apache/maven/shared/invoker/App.java:
+  Rename to
+  "src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/AppTimeout.java".
+---
+ ...AppTest.java => AppShouldSucceedTest.java} |  4 +--
+ .../org/apache/maven/shared/invoker/App.java  | 32 -------------------
+ .../maven/shared/invoker/AppTimeout.java}     |  2 +-
+ .../{AppTest.java => AppTimeoutTest.java}     |  2 +-
+ 4 files changed, 4 insertions(+), 36 deletions(-)
+ rename src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/{AppTest.java => AppShouldSucceedTest.java} (94%)
+ delete mode 100644 src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/App.java
+ rename src/test/resources/{test-build-should-succeed/src/main/java/org/apache/maven/shared/invoker/App.java => test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/AppTimeout.java} (97%)
+ rename src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/{AppTest.java => AppTimeoutTest.java} (97%)
+
+diff --git a/src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppTest.java b/src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppShouldSucceedTest.java
+similarity index 94%
+rename from src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppTest.java
+rename to src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppShouldSucceedTest.java
+index 785d70c..9b5bb0a 100644
+--- a/src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppTest.java
++++ b/src/test/resources/test-build-should-succeed/src/test/java/org/apache/maven/shared/invoker/AppShouldSucceedTest.java
+@@ -26,7 +26,7 @@ import junit.framework.TestSuite;
+ /**
+  * Unit test for simple App.
+  */
+-public class AppTest 
++public class AppShouldSucceedTest
+     extends TestCase
+ {
+     /**
+@@ -34,7 +34,7 @@ public class AppTest
+      *
+      * @param testName name of the test case
+      */
+-    public AppTest( String testName )
++    public AppShouldSucceedTest( String testName )
+     {
+         super( testName );
+     }
+diff --git a/src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/App.java b/src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/App.java
+deleted file mode 100644
+index 753a51c..0000000
+--- a/src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/App.java
++++ /dev/null
+@@ -1,32 +0,0 @@
+-package org.apache.maven.shared.invoker;
+-
+-/*
+- * Licensed to the Apache Software Foundation (ASF) under one
+- * or more contributor license agreements.  See the NOTICE file
+- * distributed with this work for additional information
+- * regarding copyright ownership.  The ASF licenses this file
+- * to you under the Apache License, Version 2.0 (the
+- * "License"); you may not use this file except in compliance
+- * with the License.  You may obtain a copy of the License at
+- *
+- *   http://www.apache.org/licenses/LICENSE-2.0
+- *
+- * Unless required by applicable law or agreed to in writing,
+- * software distributed under the License is distributed on an
+- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+- * KIND, either express or implied.  See the License for the
+- * specific language governing permissions and limitations
+- * under the License.
+- */
+-
+-/**
+- * Hello world!
+- *
+- */
+-public class App 
+-{
+-    public static void main( String[] args )
+-    {
+-        System.out.println( "Hello World!" );
+-    }
+-}
+diff --git a/src/test/resources/test-build-should-succeed/src/main/java/org/apache/maven/shared/invoker/App.java b/src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/AppTimeout.java
+similarity index 97%
+rename from src/test/resources/test-build-should-succeed/src/main/java/org/apache/maven/shared/invoker/App.java
+rename to src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/AppTimeout.java
+index 753a51c..d94b104 100644
+--- a/src/test/resources/test-build-should-succeed/src/main/java/org/apache/maven/shared/invoker/App.java
++++ b/src/test/resources/test-build-should-timeout/src/main/java/org/apache/maven/shared/invoker/AppTimeout.java
+@@ -23,7 +23,7 @@ package org.apache.maven.shared.invoker;
+  * Hello world!
+  *
+  */
+-public class App 
++public class AppTimeout
+ {
+     public static void main( String[] args )
+     {
+diff --git a/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java b/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTimeoutTest.java
+similarity index 97%
+rename from src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java
+rename to src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTimeoutTest.java
+index 27808ea..2bdeda4 100644
+--- a/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTest.java
++++ b/src/test/resources/test-build-should-timeout/src/test/java/org/apache/maven/shared/invoker/AppTimeoutTest.java
+@@ -24,7 +24,7 @@ import org.junit.Test;
+ /**
+  * Unit test for simple App.
+  */
+-public class AppTest
++public class AppTimeoutTest
+ {
+ 
+     /**
+-- 
+2.25.1
+
-- 
2.25.1


[-- Attachment #1.3: Type: text/plain, Size: 295 bytes --]


- Artyom

References:
1. https://maven.apache.org/shared/maven-invoker/index.html

-- 
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
Home page: https://memory-heap.org/~avp/
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE  B57C E9C5 A2D9 0898 A02F

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

             reply	other threads:[~2022-06-18 14:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-18 14:58 Artyom V. Poptsov [this message]
2022-06-18 19:56 ` [bug#56054] [PATCH] gnu: Add maven-shared-invoker Julien Lepiller
2022-08-04  9:11   ` Ludovic Courtès

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=87a6aavx17.fsf@gmail.com \
    --to=poptsov.artyom@gmail.com \
    --cc=56054@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.