diff --git a/build.gradle.kts b/build.gradle.kts index 1e4a1936..32735170 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,8 +17,8 @@ subprojects { apply(from = "$rootDir/gradle/spotless.gradle") pluginManager.withPlugin("java-library") { configure { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } repositories { diff --git a/otel-extensions/build.gradle.kts b/otel-extensions/build.gradle.kts index 2841856f..14f17629 100644 --- a/otel-extensions/build.gradle.kts +++ b/otel-extensions/build.gradle.kts @@ -38,6 +38,15 @@ dependencies { implementation("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") implementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") implementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") { + constraints { + implementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling-java9") { + attributes { + // this transitive dependency creates classes compatible with Java 9 and up, but is only referenced in safe ways for + // java 8 by the javaagent-tooling dependency + attribute(Attribute.of("org.gradle.jvm.version", Integer::class.java), 9 as Integer) + } + } + } exclude("io.opentelemetry.javaagent", "opentelemetry-javaagent-bootstrap") } diff --git a/testing-common/build.gradle.kts b/testing-common/build.gradle.kts index eb42fae4..6cb5d2e3 100644 --- a/testing-common/build.gradle.kts +++ b/testing-common/build.gradle.kts @@ -20,7 +20,17 @@ dependencies { testFixturesApi("com.squareup.okhttp3:logging-interceptor:4.9.0") testFixturesImplementation("io.opentelemetry:opentelemetry-exporter-logging") testFixturesImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap") - testFixturesImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") + testFixturesImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") { + constraints { + testFixturesImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling-java9") { + attributes { + // this transitive dependency creates classes compatible with Java 9 and up, but is only referenced in safe ways for + // java 8 by the javaagent-tooling dependency + attribute(Attribute.of("org.gradle.jvm.version", Integer::class.java), 9 as Integer) + } + } + } + } testFixturesImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") testFixturesImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") testFixturesImplementation("ch.qos.logback:logback-classic:1.4.6")