* [bug#53872] [PATCH] gnu: maven: Use required logger
@ 2022-02-08 9:42 Julien Lepiller
2022-02-16 15:03 ` Ludovic Courtès
0 siblings, 1 reply; 3+ messages in thread
From: Julien Lepiller @ 2022-02-08 9:42 UTC (permalink / raw)
To: 53872
[-- Attachment #1: Type: text/plain, Size: 761 bytes --]
Hi Guix!
I figured there was a small issue with our maven package. It warns that
the current logger is not supported, and lists no supported logger.
This is because I forgot to copy resources in maven-embedder (first
patch). I also noticed I missed resources in maven-compat, so I fixed
that in the second patch.
Then, maven uses its own logger instead of a default one, even if it
does support slf4j-simple. The third patch adds maven-slf4j-wrapper. It
is essentially a fork of slf4j-simple, but the way it's written
requires me to copy most of slf4j-simple's sources. The last patch
switches the use of slf4j-simple to maven-slf4j-provider. I checked
that java-jmh still builds properly with this change, and no warnings
are shown about the logger anymore.
[-- Attachment #2: 0001-gnu-maven-embedder-Install-resources.patch --]
[-- Type: text/x-patch, Size: 1187 bytes --]
From 6af76778dd0fb3436e673ee00984fb87fb72cdde Mon Sep 17 00:00:00 2001
Message-Id: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 8 Feb 2022 10:20:28 +0100
Subject: [PATCH 1/4] gnu: maven-embedder: Install resources.
* gnu/packages/maven.scm (maven-embedder)[arguments]: Add copy-resources
phase.
---
gnu/packages/maven.scm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index ba4f111930..b7ae2cc225 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1791,6 +1791,10 @@ (define-public maven-embedder
(invoke "./sisu.sh" "maven-embedder/src/main/java"
"build/classes/META-INF/sisu/javax.inject.Named")
#t))
+ (add-before 'build 'copy-resources
+ (lambda _
+ (mkdir-p "build/classes/")
+ (copy-recursively "maven-embedder/src/main/resources" "build/classes")))
(add-before 'build 'generate-models
(lambda* (#:key inputs #:allow-other-keys)
(define (modello-single-mode file version mode)
--
2.34.0
[-- Attachment #3: 0002-gnu-maven-compat-Install-resources.patch --]
[-- Type: text/x-patch, Size: 1334 bytes --]
From 3b44f6052ce0d9aa65d2642f8561d585fbdb8dd3 Mon Sep 17 00:00:00 2001
Message-Id: <3b44f6052ce0d9aa65d2642f8561d585fbdb8dd3.1644313064.git.julien@lepiller.eu>
In-Reply-To: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
References: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 8 Feb 2022 10:24:41 +0100
Subject: [PATCH 2/4] gnu: maven-compat: Install resources.
* gnu/packages/maven.scm (maven-compat)[arguments]: Add copy-resources
phase.
---
gnu/packages/maven.scm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index b7ae2cc225..b95aec121b 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -2000,6 +2000,10 @@ (define-public maven-compat
(modello-single-mode file "1.0.0" "xpp3-reader")
(modello-single-mode file "1.0.0" "xpp3-writer"))
#t))
+ (add-before 'build 'copy-resources
+ (lambda _
+ (mkdir-p "build/classes/")
+ (copy-recursively "src/main/resources" "build/classes")))
(add-after 'build 'generate-metadata
(lambda _
(invoke "java" "-cp" (string-append (getenv "CLASSPATH") ":build/classes")
--
2.34.0
[-- Attachment #4: 0003-gnu-Add-maven-slf4j-provider.patch --]
[-- Type: text/x-patch, Size: 2559 bytes --]
From 9eef3c21cc802abf76f4037000a378d8cb4f7812 Mon Sep 17 00:00:00 2001
Message-Id: <9eef3c21cc802abf76f4037000a378d8cb4f7812.1644313064.git.julien@lepiller.eu>
In-Reply-To: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
References: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 8 Feb 2022 10:26:22 +0100
Subject: [PATCH 3/4] gnu: Add maven-slf4j-provider.
* gnu/packages/maven.scm (maven-slf4-provider): New variable.
---
gnu/packages/maven.scm | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index b95aec121b..cf07c08b8e 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1772,6 +1772,40 @@ (define-public maven-core
("maven-core-boot" ,maven-core-bootstrap)
,@(package-native-inputs maven-core-bootstrap)))))
+(define-public maven-slf4j-provider
+ (package
+ (inherit maven-artifact)
+ (name "maven-slf4j-provider")
+ (arguments
+ `(#:jar-name "maven-slf4j-provider.jar"
+ #:source-dir "maven-slf4j-provider/src/main/java"
+ #:tests? #f; no tests
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'unpack-slf4j
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "generated-sources")
+ (with-directory-excursion "generated-sources"
+ (invoke "tar" "xf" (assoc-ref inputs "java-slf4j-simple-source"))
+ (for-each delete-file (find-files "." "StaticLoggerBinder.java")))
+ (for-each
+ (lambda (simple)
+ (for-each
+ (lambda (java)
+ (copy-file java
+ (string-append
+ "maven-slf4j-provider/src/main/java/org/slf4j/impl/"
+ (basename java))))
+ (find-files (string-append simple "/src/main/java/") "\\.java$")))
+ (find-files "generated-sources" "slf4j-simple" #:directories? #t))))
+ (replace 'install
+ (install-from-pom "maven-slf4j-provider/pom.xml")))))
+ (inputs
+ `(("java-slf4j-api" ,java-slf4j-api)
+ ("java-slf4j-simple-source" ,(package-source java-slf4j-simple))
+ ("maven-shared-utils" ,maven-shared-utils)))
+ (native-inputs (list unzip))))
+
(define-public maven-embedder
(package
(inherit maven-artifact)
--
2.34.0
[-- Attachment #5: 0004-gnu-maven-Use-maven-slf4j-provider-instead-of-slf4j-.patch --]
[-- Type: text/x-patch, Size: 5227 bytes --]
From e7fe8f9973b32d8f6114dbf4aee3807adf2c8fb5 Mon Sep 17 00:00:00 2001
Message-Id: <e7fe8f9973b32d8f6114dbf4aee3807adf2c8fb5.1644313064.git.julien@lepiller.eu>
In-Reply-To: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
References: <6af76778dd0fb3436e673ee00984fb87fb72cdde.1644313064.git.julien@lepiller.eu>
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 8 Feb 2022 10:32:32 +0100
Subject: [PATCH 4/4] gnu: maven: Use maven-slf4j-provider instead of
slf4j-simple.
Maven uses its own slf4j implementation, not the default one. The main
difference is the color on the output.
* gnu/packages/maven.scm (maven-wagon-http, maven-embedder, maven-compat)
(maven): Replace slf4j-simple with maven-slf4j-provider.
---
gnu/packages/maven.scm | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/maven.scm b/gnu/packages/maven.scm
index cf07c08b8e..edf93f276b 100644
--- a/gnu/packages/maven.scm
+++ b/gnu/packages/maven.scm
@@ -1088,6 +1088,7 @@ (define-public maven-wagon-http
("java-plexus-cli" ,java-plexus-cli)
("maven-plugin-api" ,maven-plugin-api)
("maven-plugin-annotations" ,maven-plugin-annotations)
+ ("maven-slf4j-provider" ,maven-slf4j-provider)
("maven-core" ,maven-core)
("maven-model" ,maven-model)
("java-commons-cli" ,java-commons-cli)
@@ -1106,7 +1107,6 @@ (define-public maven-wagon-http
("java-commons-codec" ,java-commons-codec)
("java-commons-io" ,java-commons-io)
("java-jsoup" ,java-jsoup)
- ("java-slf4j-simple" ,java-slf4j-simple)
,@(package-native-inputs maven-wagon-provider-api)))
(synopsis "Wagon provider that gets and puts artifacts through HTTP(S)")
(description "Maven Wagon is a transport abstraction that is used in Maven's
@@ -1874,6 +1874,7 @@ (define-public maven-embedder
("maven-settings" ,maven-settings)
("maven-settings-builder" ,maven-settings-builder)
("maven-shared-utils" ,maven-shared-utils)
+ ("maven-slf4j-provider" ,maven-slf4j-provider)
("java-plexus-classworlds" ,java-plexus-classworlds)
("java-plexus-util" ,java-plexus-utils)
("java-eclipse-sisu-plexus" ,java-eclipse-sisu-plexus)
@@ -1891,7 +1892,6 @@ (define-public maven-embedder
("java-guice" ,java-guice)
("java-javax-inject" ,java-javax-inject)
("java-slf4j-api" ,java-slf4j-api)
- ("java-slf4j-simple" ,java-slf4j-simple)
("java-jsr250" ,java-jsr250)))
(native-inputs
`(("java-asm-8" ,java-asm-8)
@@ -2122,8 +2122,8 @@ (define-public maven-compat
("java-commons-lang3" ,java-commons-lang3)
("java-aop" ,java-aopalliance)
("maven-resolver-provider" ,maven-resolver-provider)
+ ("maven-slf4j-provider" ,maven-slf4j-provider)
("java-slf4j-api" ,java-slf4j-api)
- ("java-slf4j-simple" ,java-slf4j-simple)
,@(package-inputs java-slf4j-api)))
(description "Apache Maven is a software project management and comprehension
tool. This package contains Maven2 classes maintained as compatibility
@@ -2161,7 +2161,8 @@ (define-public maven
"maven-repository-metadata" "maven-shared-utils" "maven-resolver-api"
"maven-resolver-spi" "maven-resolver-util" "maven-resolver-impl"
"maven-resolver-connector-basic" "maven-resolver-provider"
- "maven-resolver-transport-wagon" "maven-wagon-provider-api"
+ "maven-resolver-transport-wagon" "maven-slf4j-provider"
+ "maven-wagon-provider-api"
"maven-wagon-file" "maven-wagon-http" "java-commons-logging-minimal"
"java-httpcomponents-httpclient" "java-httpcomponents-httpcore"
"maven-wagon-http-shared" "maven-wagon-tck-http"
@@ -2171,8 +2172,7 @@ (define-public maven
"java-plexus-utils" "java-plexus-interpolation"
"java-plexus-sec-dispatcher" "java-plexus-cipher" "java-guava"
"java-jansi" "java-jsr250" "java-cdi-api" "java-commons-cli"
- "java-commons-io" "java-commons-lang3" "java-slf4j-api"
- "java-slf4j-simple"))))
+ "java-commons-io" "java-commons-lang3" "java-slf4j-api"))))
(substitute* "apache-maven/src/bin/mvn"
(("cygwin=false;")
(string-append
@@ -2218,6 +2218,7 @@ (define-public maven
maven-resolver-connector-basic
maven-resolver-provider
maven-resolver-transport-wagon
+ maven-slf4j-provider
maven-wagon-provider-api
maven-wagon-file
maven-wagon-http
@@ -2245,9 +2246,7 @@ (define-public maven
java-commons-cli
java-commons-io
java-commons-lang3
- java-slf4j-api
- ;; TODO: replace with maven-slf4j-provider
- java-slf4j-simple))
+ java-slf4j-api))
(propagated-inputs
(list coreutils which))
(description "Apache Maven is a software project management and comprehension
--
2.34.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#53872] [PATCH] gnu: maven: Use required logger
2022-02-08 9:42 [bug#53872] [PATCH] gnu: maven: Use required logger Julien Lepiller
@ 2022-02-16 15:03 ` Ludovic Courtès
2022-02-28 10:00 ` bug#53872: " Julien Lepiller
0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2022-02-16 15:03 UTC (permalink / raw)
To: Julien Lepiller; +Cc: 53872
Hi,
Julien Lepiller <julien@lepiller.eu> skribis:
> I figured there was a small issue with our maven package. It warns that
> the current logger is not supported, and lists no supported logger.
> This is because I forgot to copy resources in maven-embedder (first
> patch). I also noticed I missed resources in maven-compat, so I fixed
> that in the second patch.
>
> Then, maven uses its own logger instead of a default one, even if it
> does support slf4j-simple. The third patch adds maven-slf4j-wrapper. It
> is essentially a fork of slf4j-simple, but the way it's written
> requires me to copy most of slf4j-simple's sources. The last patch
> switches the use of slf4j-simple to maven-slf4j-provider. I checked
> that java-jmh still builds properly with this change, and no warnings
> are shown about the logger anymore.
I know nothing about Maven but I’d say you can go ahead if the other
Java folks around here have nothing to say.
(When do we set up teams? :-))
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#53872: [PATCH] gnu: maven: Use required logger
2022-02-16 15:03 ` Ludovic Courtès
@ 2022-02-28 10:00 ` Julien Lepiller
0 siblings, 0 replies; 3+ messages in thread
From: Julien Lepiller @ 2022-02-28 10:00 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: 53872-done
With no other answer after more than two weeks since I posted the patch
series, pushed to master as ea23386e084a035e4bc23273fffc3d114b311789 -
9aae8a3e0d53fd0c11b8e98e1fd2d2232598b036. Thanks!
Le Wed, 16 Feb 2022 16:03:23 +0100,
Ludovic Courtès <ludo@gnu.org> a écrit :
> Hi,
>
> Julien Lepiller <julien@lepiller.eu> skribis:
>
> > I figured there was a small issue with our maven package. It warns
> > that the current logger is not supported, and lists no supported
> > logger. This is because I forgot to copy resources in
> > maven-embedder (first patch). I also noticed I missed resources in
> > maven-compat, so I fixed that in the second patch.
> >
> > Then, maven uses its own logger instead of a default one, even if it
> > does support slf4j-simple. The third patch adds
> > maven-slf4j-wrapper. It is essentially a fork of slf4j-simple, but
> > the way it's written requires me to copy most of slf4j-simple's
> > sources. The last patch switches the use of slf4j-simple to
> > maven-slf4j-provider. I checked that java-jmh still builds properly
> > with this change, and no warnings are shown about the logger
> > anymore.
>
> I know nothing about Maven but I’d say you can go ahead if the other
> Java folks around here have nothing to say.
> (When do we set up teams? :-))
>
> Thanks,
> Ludo’.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-28 10:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 9:42 [bug#53872] [PATCH] gnu: maven: Use required logger Julien Lepiller
2022-02-16 15:03 ` Ludovic Courtès
2022-02-28 10:00 ` bug#53872: " Julien Lepiller
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).