diff --git a/0001-Adapt-mvn-script.patch b/0001-Adapt-mvn-script.patch index 0f2ed58..4258ea4 100644 --- a/0001-Adapt-mvn-script.patch +++ b/0001-Adapt-mvn-script.patch @@ -1,7 +1,7 @@ From 8ef7cdcdc1c40742fb091177afe17f771a518f90 Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Wed, 1 Feb 2017 14:54:26 +0100 -Subject: [PATCH 1/3] Adapt mvn script +Subject: [PATCH 1/4] Adapt mvn script --- apache-maven/src/bin/mvn | 19 ++++++++++++++++--- @@ -65,5 +65,5 @@ index 623b5f2..e486b34 100755 # For Cygwin, switch paths to Windows format before running java -- -2.9.3 +2.9.4 diff --git a/0002-Update-to-current-slf4j.patch b/0002-Update-to-current-slf4j.patch index bb5cde1..1eeb155 100644 --- a/0002-Update-to-current-slf4j.patch +++ b/0002-Update-to-current-slf4j.patch @@ -1,7 +1,7 @@ From 3dce15a3da21f5817a1b0193664312ffc8a5345c Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Tue, 18 Apr 2017 16:30:58 +0200 -Subject: [PATCH 2/3] Update to current slf4j +Subject: [PATCH 2/4] Update to current slf4j --- .../src/main/java/org/slf4j/impl/MavenSimpleLogger.java | 7 ++++++- @@ -27,5 +27,5 @@ index 17f1f48..c4acb92 100644 if ( t.getMessage() != null ) { -- -2.9.3 +2.9.4 diff --git a/0003-Replace-groovy-invocation-with-antrun.patch b/0003-Replace-groovy-invocation-with-antrun.patch index 8d4464f..d6b4e03 100644 --- a/0003-Replace-groovy-invocation-with-antrun.patch +++ b/0003-Replace-groovy-invocation-with-antrun.patch @@ -1,7 +1,7 @@ From b54789188f2a61b5d58ff53986a5efe042d84fdf Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Tue, 18 Apr 2017 16:51:34 +0200 -Subject: [PATCH 3/3] Replace groovy invocation with antrun +Subject: [PATCH 3/4] Replace groovy invocation with antrun --- maven-slf4j-provider/pom.xml | 23 ++++++++++++++--------- @@ -50,5 +50,5 @@ index 363e00d..9be251b 100644 \ No newline at end of file + -- -2.9.3 +2.9.4 diff --git a/0004-Invoke-logback-via-reflection.patch b/0004-Invoke-logback-via-reflection.patch new file mode 100644 index 0000000..8593539 --- /dev/null +++ b/0004-Invoke-logback-via-reflection.patch @@ -0,0 +1,53 @@ +From ee59ac079ca7c945c4284fc078526ff3faeadfa1 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Tue, 6 Jun 2017 13:47:43 +0200 +Subject: [PATCH 4/4] Invoke logback via reflection + +--- + .../maven/cli/logging/impl/LogbackConfiguration.java | 19 ++++++++++++++----- + 1 file changed, 14 insertions(+), 5 deletions(-) + +diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +index 5d9fab7..ced38cb 100644 +--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java ++++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +@@ -35,22 +35,31 @@ public class LogbackConfiguration + @Override + public void setRootLoggerLevel( Level level ) + { +- ch.qos.logback.classic.Level value; ++ String value; + switch ( level ) + { + case DEBUG: +- value = ch.qos.logback.classic.Level.DEBUG; ++ value = "DEBUG"; + break; + + case INFO: +- value = ch.qos.logback.classic.Level.INFO; ++ value = "INFO"; + break; + + default: +- value = ch.qos.logback.classic.Level.ERROR; ++ value = "ERROR"; + break; + } +- ( (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ) ).setLevel( value ); ++ Logger logger = LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ); ++ try { ++ Class levelClass = Class.forName("ch.qos.logback.classic.Level"); ++ Object logbackLevel = levelClass.getField(value).get(null); ++ Class loggerClass = Class.forName("ch.qos.logback.classic.Logger"); ++ loggerClass.getMethod("setLevel", new Class[] {levelClass}) ++ .invoke(logger, new Object[] {logbackLevel}); ++ } catch (Exception e) { ++ throw new RuntimeException("Failed to initialize logback configuration", e); ++ } + } + + @Override +-- +2.9.4 + diff --git a/maven.spec b/maven.spec index 392f1fe..fa30747 100644 --- a/maven.spec +++ b/maven.spec @@ -5,7 +5,7 @@ Name: maven Epoch: 1 Version: 3.5.0 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Java project management and project comprehension tool License: ASL 2.0 URL: http://maven.apache.org/ @@ -20,6 +20,9 @@ Patch1: 0001-Adapt-mvn-script.patch Patch2: 0002-Update-to-current-slf4j.patch # Fedora specific, avoids usage of unpackaged groovy-maven-plugin Patch3: 0003-Replace-groovy-invocation-with-antrun.patch +# Downstream-specific, avoids dependency on logback +# Used only when %without logback is in effect +Patch4: 0004-Invoke-logback-via-reflection.patch BuildRequires: maven-local BuildRequires: mvn(com.google.guava:guava) @@ -169,7 +172,7 @@ sed -i 's:\r::' apache-maven/src/conf/settings.xml %if %{without logback} %pom_remove_dep -r :logback-classic -rm maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/LogbackConfiguration.java +%patch4 -p1 %endif %mvn_alias :maven-resolver-provider :maven-aether-provider @@ -238,6 +241,9 @@ ln -sf %{_sysconfdir}/%{name}/logging %{buildroot}%{_datadir}/%{name}/conf %changelog +* Thu Jun 08 2017 Michael Simacek - 1:3.5.0-4 +- Update logback conditional to replace logback usage with reflection + * Wed Apr 26 2017 Mikolaj Izdebski - 1:3.5.0-3 - Add apache-commons-codec to plexus.core - Resolves: rhbz#1445738