diff --git a/buildSrc/src/main/groovy/corda.osgi-test-conventions.gradle b/buildSrc/src/main/groovy/corda.osgi-test-conventions.gradle index a1b777fcf12..cdcd664f0cc 100644 --- a/buildSrc/src/main/groovy/corda.osgi-test-conventions.gradle +++ b/buildSrc/src/main/groovy/corda.osgi-test-conventions.gradle @@ -63,9 +63,16 @@ Test-Cases: \${classes;HIERARCHY_INDIRECTLY_ANNOTATED;org.junit.platform.commons } } +def slf4j2Dependency = libs.slf4j.api.get() + +def bundlesSet = files(sourceSets.integrationTest.runtimeClasspath.filter { + // Filter out SLF4J bundle as it will be conflicting with special bundle we provide for OSGi testing purposes: slf4jv1 + !(it.path.contains("${slf4j2Dependency.name}-${slf4j2Dependency.version}")) +}, configurations.archives.artifacts.files) + def resolve = tasks.register('resolve', Resolve) { dependsOn jar, testingBundle - bundles = files(sourceSets.integrationTest.runtimeClasspath, configurations.archives.artifacts.files) + bundles = bundlesSet bndrun = file('test.bndrun') outputBndrun = layout.buildDirectory.file('resolved-test.bndrun') doFirst { @@ -81,7 +88,7 @@ def testOSGi = tasks.register('testOSGi', TestOSGi) { languageVersion = of(17) } resultsDirectory = file("$testResultsDir/integrationTest") - bundles = files(sourceSets.integrationTest.runtimeClasspath, configurations.archives.artifacts.files) + bundles = bundlesSet bndrun = resolve.flatMap { it.outputBndrun } // These properties are for Quasar's framework extension, should it be present. diff --git a/components/ledger/ledger-verification/test.bndrun b/components/ledger/ledger-verification/test.bndrun index cd7d0efa147..e7eb32ee33e 100644 --- a/components/ledger/ledger-verification/test.bndrun +++ b/components/ledger/ledger-verification/test.bndrun @@ -37,7 +37,7 @@ bnd.identity;id='net.bytebuddy.byte-buddy',\ bnd.identity;id='junit-jupiter-engine',\ bnd.identity;id='junit-platform-launcher',\ - bnd.identity;id='slf4j.api',\ + bnd.identity;id='net.corda.slf4jv1',\ bnd.identity;id='slf4j.simple',\ bnd.identity;id='org.liquibase.core',\ bnd.identity;id='com.opencsv',\ diff --git a/components/security-manager/build.gradle b/components/security-manager/build.gradle index 8dced9b44cb..31076197d03 100644 --- a/components/security-manager/build.gradle +++ b/components/security-manager/build.gradle @@ -39,7 +39,7 @@ dependencies { integrationTestImplementation "org.osgi:org.osgi.service.component:$osgiServiceComponentVersion" integrationTestImplementation project(':testing:security-manager-utilities') integrationTestImplementation "net.corda:corda-application" - integrationTestImplementation 'org.slf4j:slf4j-api' + integrationTestRuntimeOnly project(':testing:slf4jv1') integrationTestRuntimeOnly("org.apache.felix:org.apache.felix.framework.security:$felixSecurityVersion") { exclude group: 'org.osgi' } diff --git a/components/virtual-node/sandbox-group-context-service/test.bndrun b/components/virtual-node/sandbox-group-context-service/test.bndrun index bc82d9fd3a5..5305cbe606e 100644 --- a/components/virtual-node/sandbox-group-context-service/test.bndrun +++ b/components/virtual-node/sandbox-group-context-service/test.bndrun @@ -46,7 +46,7 @@ bnd.identity;id='net.corda.test-impl-two',\ bnd.identity;id='junit-jupiter-engine',\ bnd.identity;id='junit-platform-launcher',\ - bnd.identity;id='slf4j.api',\ + bnd.identity;id='net.corda.slf4jv1',\ bnd.identity;id='slf4j.simple' -runstartlevel: \ diff --git a/libs/configuration/configuration-validation/build.gradle b/libs/configuration/configuration-validation/build.gradle index fb3459df2c6..154692ce217 100644 --- a/libs/configuration/configuration-validation/build.gradle +++ b/libs/configuration/configuration-validation/build.gradle @@ -28,4 +28,5 @@ dependencies { because "Version bundled with current version of 'com.networknt:json-schema-validator' does not have OSGi manifest." } } + integrationTestRuntimeOnly project(':testing:slf4jv1') } \ No newline at end of file diff --git a/libs/kotlin-reflection/build.gradle b/libs/kotlin-reflection/build.gradle index b4b6e69e963..282a800895c 100644 --- a/libs/kotlin-reflection/build.gradle +++ b/libs/kotlin-reflection/build.gradle @@ -53,8 +53,8 @@ dependencies { testRuntimeOnly "org.ow2.asm:asm:$asmVersion" integrationTestImplementation project(':libs:kotlin-reflection:kotlin-reflection-test-example') - integrationTestImplementation 'org.slf4j:slf4j-api' integrationTestImplementation "org.apache.felix:org.apache.felix.framework:$felixVersion" + integrationTestImplementation project(':testing:slf4jv1') integrationTestImplementation libs.junit integrationTestRuntimeOnly libs.junit.engine integrationTestRuntimeOnly libs.junit.platform diff --git a/libs/layered-property-map/build.gradle b/libs/layered-property-map/build.gradle index 90d7dfa4b29..3b6210caaa8 100644 --- a/libs/layered-property-map/build.gradle +++ b/libs/layered-property-map/build.gradle @@ -26,4 +26,5 @@ dependencies { testImplementation project(":testing:test-utilities") integrationTestImplementation project(":libs:layered-property-map:layered-property-map-test-converter") + integrationTestRuntimeOnly project(':testing:slf4jv1') } \ No newline at end of file diff --git a/libs/sandbox-internal/test.bndrun b/libs/sandbox-internal/test.bndrun index 4f7000ff6e4..cf1d3c42e9a 100644 --- a/libs/sandbox-internal/test.bndrun +++ b/libs/sandbox-internal/test.bndrun @@ -31,7 +31,7 @@ bnd.identity;id='co.paralleluniverse.quasar-core',\ bnd.identity;id='junit-jupiter-engine',\ bnd.identity;id='junit-platform-launcher',\ - bnd.identity;id='slf4j.api',\ + bnd.identity;id='net.corda.slf4jv1',\ bnd.identity;id='slf4j.simple' -runstartlevel: \ diff --git a/testing/p2p/inmemory-messaging-impl/build.gradle b/testing/p2p/inmemory-messaging-impl/build.gradle index 8db7542c13a..f55913b3a78 100644 --- a/testing/p2p/inmemory-messaging-impl/build.gradle +++ b/testing/p2p/inmemory-messaging-impl/build.gradle @@ -25,4 +25,5 @@ dependencies { integrationTestApi project(":testing:test-utilities") testImplementation project(":libs:lifecycle:lifecycle-impl") + integrationTestRuntimeOnly project(':testing:slf4jv1') } diff --git a/testing/sandboxes/src/main/kotlin/net/corda/testing/sandboxes/impl/SandboxSetupImpl.kt b/testing/sandboxes/src/main/kotlin/net/corda/testing/sandboxes/impl/SandboxSetupImpl.kt index f6d16c68086..11e15fdc527 100644 --- a/testing/sandboxes/src/main/kotlin/net/corda/testing/sandboxes/impl/SandboxSetupImpl.kt +++ b/testing/sandboxes/src/main/kotlin/net/corda/testing/sandboxes/impl/SandboxSetupImpl.kt @@ -70,7 +70,7 @@ class SandboxSetupImpl @Activate constructor( "org.apache.felix.scr", "org.hibernate.orm.core", "org.jetbrains.kotlin.osgi-bundle", - "slf4j.api" + "net.corda.slf4jv1" )) private val REPLACEMENT_SERVICES = unmodifiableSet(setOf( diff --git a/testing/slf4jv1/build.gradle b/testing/slf4jv1/build.gradle index 5b1b3216e87..50ee10ac25f 100644 --- a/testing/slf4jv1/build.gradle +++ b/testing/slf4jv1/build.gradle @@ -21,7 +21,7 @@ tasks.named('jar', Jar) { archiveBaseName = 'corda-slf4jv1' ext { - bundleVersion = parseMavenString(antlrVersion).OSGiVersion + bundleVersion = parseMavenString(libs.slf4j.api.get().version).OSGiVersion } bundle {