You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ba...@apache.org on 2026/05/19 17:47:56 UTC

(jackrabbit-oak) 03/03: OAK-10339: Migrate to SLF4J 2.x

This is an automated email from the ASF dual-hosted git repository.

mbaedke pushed a commit to branch issue/oak-10339
in repository https://gitbox.apache.org/repos/asf/jackrabbit-oak.git

commit bfd16c9cfe2c140dbd4cbe15906ae0226734d26c
Author: Manfred Baedke <ma...@gmail.com>
AuthorDate: Tue May 19 19:37:19 2026 +0200

    OAK-10339: Migrate to SLF4J 2.x
    
    Fixed broken OSGi ITs after rebasing the branch onto trunk.
---
 oak-it-osgi/pom.xml                                |  2 +-
 .../oak/osgi/IndexVersionSelectionIT.java          |  9 +++----
 .../org/apache/jackrabbit/oak/osgi/OSGiIT.java     | 29 ++++++++++++++--------
 .../jackrabbit/oak/osgi/TikaExtractionOsgiIT.java  | 20 ++++++---------
 oak-it-osgi/src/test/resources/versions.properties |  3 ---
 oak-it-osgi/test-bundles.xml                       |  2 ++
 6 files changed, 32 insertions(+), 33 deletions(-)

diff --git a/oak-it-osgi/pom.xml b/oak-it-osgi/pom.xml
index 2e4952cbe0..5814af4281 100644
--- a/oak-it-osgi/pom.xml
+++ b/oak-it-osgi/pom.xml
@@ -317,7 +317,7 @@
     <dependency>
       <groupId>org.apache.sling</groupId>
       <artifactId>org.apache.sling.testing.paxexam</artifactId>
-      <version>3.1.0</version>
+      <version>4.1.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/IndexVersionSelectionIT.java b/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/IndexVersionSelectionIT.java
index a7a2a82ff3..921ff3b388 100644
--- a/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/IndexVersionSelectionIT.java
+++ b/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/IndexVersionSelectionIT.java
@@ -290,14 +290,11 @@ public class IndexVersionSelectionIT {
                 mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.9.20"),
                 mavenBundle("org.apache.felix", "org.apache.felix.fileinstall", "3.2.6"),
                 mavenBundle("org.ops4j.pax.logging", "pax-logging-api", "1.7.2"),
-                // Jackson dependency for object serialisation.
-                // (these only need to be defined here when the versions are different from the ones
-                // defined in the project -- otherwise -> "bundle symbolic name and version are not unique")
-                mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-core").version("2.19.1"),
-                mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-annotations").version("2.19.1"),
-                mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-databind").version("2.19.1"),
                 mavenBundle().groupId("com.github.ben-manes.caffeine").artifactId("caffeine").version("3.1.8"),
+                mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),
 
+                // required for slf4j 2.0.x
+                OSGiIT.spyflyOptions(),
                 frameworkProperty("repository.home").value("target"),
 
                 systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
diff --git a/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java b/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
index e04b41d040..449b130f5d 100644
--- a/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
+++ b/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.oak.osgi;
 
 import static org.junit.Assert.assertEquals;
 import static org.ops4j.pax.exam.CoreOptions.bundle;
+import static org.ops4j.pax.exam.CoreOptions.composite;
 import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
 import static org.ops4j.pax.exam.CoreOptions.junitBundles;
 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
@@ -36,7 +37,6 @@ import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.oak.plugins.document.spi.lease.LeaseFailureHandler;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
-import org.apache.sling.testing.paxexam.SlingOptions;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.ops4j.pax.exam.Configuration;
@@ -72,25 +72,34 @@ public class OSGiIT {
                 mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", "1.9.20" ),
                 mavenBundle( "org.apache.felix", "org.apache.felix.fileinstall", "3.2.6" ),
                 mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "1.7.2" ),
-                // Jackson dependency for object serialisation.
-                // (these only need to be defined here when the versions are different from the ones
-                // defined in the project -- otherwise -> "bundle symbolic name and version are not unique")
-                mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-core").version("2.19.1"),
-                mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-annotations").version("2.19.1"),
-                mavenBundle().groupId("com.fasterxml.jackson.core").artifactId("jackson-databind").version("2.19.1"),
-
                 mavenBundle().groupId("com.github.ben-manes.caffeine").artifactId("caffeine").version("3.1.8"),
-
                 mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),
 
                 // required for slf4j 2.0.x
-                SlingOptions.spyfly(),
+                spyflyOptions(),
                 frameworkProperty("repository.home").value("target"),
                 systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
                 jarBundles(),
                 jpmsOptions());
     }
 
+    /**
+     * Provides Apache Aries SPI Fly 1.3.x for SLF4J 2.x service-loader mediation in OSGi.
+     * SPI Fly 1.2.x (bundled by sling.testing.paxexam 3.1.0) embeds ASM 5.x and cannot
+     * weave Java 11+ bytecode. Version 1.3.7 uses external ASM 9.x and supports modern class files.
+     */
+    static Option spyflyOptions() {
+        return composite(
+            mavenBundle("org.apache.aries", "org.apache.aries.util", "1.1.3"),
+            mavenBundle("org.ow2.asm", "asm", "9.7.1"),
+            mavenBundle("org.ow2.asm", "asm-tree", "9.7.1"),
+            mavenBundle("org.ow2.asm", "asm-analysis", "9.7.1"),
+            mavenBundle("org.ow2.asm", "asm-commons", "9.7.1"),
+            mavenBundle("org.ow2.asm", "asm-util", "9.7.1"),
+            mavenBundle("org.apache.aries.spifly", "org.apache.aries.spifly.dynamic.bundle", "1.3.7")
+        );
+    }
+
     static Option jpmsOptions(){
         DefaultCompositeOption composite = new DefaultCompositeOption();
         if (Version.parseVersion(System.getProperty("java.specification.version")).getMajor() > 1){
diff --git a/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java b/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java
index b13cb317ba..e633f6bf07 100644
--- a/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java
+++ b/oak-it-osgi/src/test/java/org/apache/jackrabbit/oak/osgi/TikaExtractionOsgiIT.java
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.osgi;
 
-import org.apache.sling.testing.paxexam.SlingOptions;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.parser.AutoDetectParser;
 import org.apache.tika.parser.Parser;
@@ -77,14 +76,10 @@ public class TikaExtractionOsgiIT {
     private static final String VERSION_PROP_RESOURCE_NAME = "versions.properties";
     private static final String TIKA_VERSION = "tika";
     private static final String POI_VERSION = "poi";
-    private static final String COLLECTIONS4_VERSION = "commons-collections4";
     private static final String COMPRESS_VERSION = "commons-compress";
-    private static final String LANG3_VERSION = "commons-lang3";
-    private static final String MATH3_VERSION = "commons-math3";
     private static final String COMMONS_CSV_VERSION = "commons-csv";
-    private static final String[] VERSION_KEYS = new String[]{TIKA_VERSION, POI_VERSION
-            , COLLECTIONS4_VERSION, COMPRESS_VERSION
-            , LANG3_VERSION, MATH3_VERSION, COMMONS_CSV_VERSION};
+    private static final String[] VERSION_KEYS = new String[]{TIKA_VERSION, POI_VERSION, COMPRESS_VERSION,
+            COMMONS_CSV_VERSION};
 
     private static final String EXPECTED_TEXT_FRAGMENT = "A sample document";
     private static final String EXPECTED_CSV_FRAGMENT =
@@ -109,7 +104,10 @@ public class TikaExtractionOsgiIT {
                 mavenBundle( "org.ops4j.pax.logging", "pax-logging-api", "1.7.2" ),
                 mavenBundle("org.apache.logging.log4j", "log4j-api", "2.23.0"),
                 mavenBundle("jakarta.servlet", "jakarta.servlet-api", "5.0.0"),
-                SlingOptions.spyfly(),
+                mavenBundle().groupId("com.github.ben-manes.caffeine").artifactId("caffeine").version("3.1.8"),
+
+                // required for slf4j 2.0.x
+                OSGiIT.spyflyOptions(),
                 setupTikaAndPoi(),
                 frameworkProperty("repository.home").value("target"),
                 systemProperties(new SystemPropertyOption("felix.fileinstall.dir").value(getConfigDir())),
@@ -124,8 +122,7 @@ public class TikaExtractionOsgiIT {
         Map<String, String> versions = setupVersions();
         return composite(
                 composite(
-                        mavenBundle("org.apache.tika", "tika-core", versions.get(TIKA_VERSION))
-                        , mavenBundle("org.apache.tika", "tika-parsers", versions.get(TIKA_VERSION))
+                        mavenBundle("org.apache.tika", "tika-parsers", versions.get(TIKA_VERSION))
                         // for csv parsing
                         , mavenBundle("org.apache.commons", "commons-csv", versions.get(COMMONS_CSV_VERSION))
                         // poi dependency start
@@ -137,10 +134,7 @@ public class TikaExtractionOsgiIT {
                         , wrappedBundle(mavenBundle("org.apache.poi", "ooxml-security", "1.0"))
                         , wrappedBundle(mavenBundle("org.apache.xmlbeans", "xmlbeans", "5.0.3"))
                         , wrappedBundle(mavenBundle("com.drewnoakes", "metadata-extractor", "2.6.2"))
-                        , mavenBundle("org.apache.commons", "commons-collections4", versions.get(COLLECTIONS4_VERSION))
                         , mavenBundle("org.apache.commons", "commons-compress", versions.get(COMPRESS_VERSION))
-                        , mavenBundle("org.apache.commons", "commons-lang3", versions.get(LANG3_VERSION))
-                        , mavenBundle("org.apache.commons", "commons-math3", versions.get(MATH3_VERSION))
                         // poi dependency end
                 )
                 , OSGiIT.jarBundles()
diff --git a/oak-it-osgi/src/test/resources/versions.properties b/oak-it-osgi/src/test/resources/versions.properties
index f9f61fba5a..02763da5c3 100644
--- a/oak-it-osgi/src/test/resources/versions.properties
+++ b/oak-it-osgi/src/test/resources/versions.properties
@@ -16,8 +16,5 @@
 #
 tika=${tika.version}
 poi=5.2.2
-commons-collections4=4.4
 commons-compress=1.28.0
-commons-lang3=3.18.0
-commons-math3=3.6.1
 commons-csv=1.14.1
diff --git a/oak-it-osgi/test-bundles.xml b/oak-it-osgi/test-bundles.xml
index 96fdb9928d..82acab2edf 100644
--- a/oak-it-osgi/test-bundles.xml
+++ b/oak-it-osgi/test-bundles.xml
@@ -37,6 +37,8 @@
         <include>commons-io:commons-io</include>
         <include>commons-logging:commons-logging</include>
         <include>com.fasterxml.jackson.core:jackson-core</include>
+        <include>com.fasterxml.jackson.core:jackson-databind</include>
+        <include>com.fasterxml.jackson.core:jackson-annotations</include>
         <include>org.apache.commons:commons-lang3</include>
         <include>org.apache.commons:commons-math3</include>
         <include>org.apache.commons:commons-text</include>