From 44a583278a74c9aa8f728de19a4310ffed7459ff Mon Sep 17 00:00:00 2001 From: j-sandy <30489233+j-sandy@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:06:10 +0530 Subject: [PATCH] chore(dependency): add explicit byte-buddy dependency while upgrading spockframework to 2.2-groovy-3.0 While upgrading spockframework from 2.0-groovy-3.0 to 2.2-groovy-3.0, encountered similar errors as mentioned below during test execution of orca-mine, orca-pipelinetemplate, orca-applications, orca-echo, orca-clouddriver-provider-titus, orca-front50, orca-igor, orca-peering, orca-interlink and orca-webhook module: ``` Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @5f9b2141 at app//net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464) at app//net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:339) at app//net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:96) at app//net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:94) at app//net.sf.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) at java.base@17.0.2/java.util.concurrent.FutureTask.run(FutureTask.java:264) at app//net.sf.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) at app//net.sf.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) at app//net.sf.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:119) at app//net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:294) at app//net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) at app//net.sf.cglib.core.KeyFactory.create(KeyFactory.java:174) at app//net.sf.cglib.core.KeyFactory.create(KeyFactory.java:153) at app//net.sf.cglib.proxy.Enhancer.(Enhancer.java:73) ... 10 more Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @5f9b2141 at net.sf.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61) at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) at net.sf.cglib.core.ReflectUtils.(ReflectUtils.java:52) at net.sf.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243) at net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) at net.sf.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:332) ... 22 more ``` This issue caused due to dropping of `net.bytebuddy:byte-buddy` transitive dependency from [spock 2.2](https://repo1.maven.org/maven2/org/spockframework/spock-core/2.2-groovy-3.0/spock-core-2.2-groovy-3.0.pom), while it is part of [spock 2.0](https://repo1.maven.org/maven2/org/spockframework/spock-core/2.0-groovy-3.0/spock-core-2.0-groovy-3.0.pom). So, introducing the `testRuntimeOnly` byte-buddy explicit dependency to fix this issue. Since spring boot 2.7.18 bring byte-buddy as transitive dependency with [1.12.23](https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-dependencies/2.7.18/spring-boot-dependencies-2.7.18.pom) version, so tying the byte-buddy version with spring boot by unpinning it. --- orca-applications/orca-applications.gradle | 1 + .../orca-clouddriver-provider-titus.gradle | 1 + orca-echo/orca-echo.gradle | 1 + orca-front50/orca-front50.gradle | 1 + orca-igor/orca-igor.gradle | 1 + orca-interlink/orca-interlink.gradle | 1 + orca-mine/orca-mine.gradle | 1 + orca-peering/orca-peering.gradle | 1 + orca-pipelinetemplate/orca-pipelinetemplate.gradle | 1 + orca-webhook/orca-webhook.gradle | 1 + 10 files changed, 10 insertions(+) diff --git a/orca-applications/orca-applications.gradle b/orca-applications/orca-applications.gradle index 641db1fc49..90993e1a6e 100644 --- a/orca-applications/orca-applications.gradle +++ b/orca-applications/orca-applications.gradle @@ -29,4 +29,5 @@ dependencies { annotationProcessor("org.projectlombok:lombok") testImplementation(project(":orca-test-groovy")) + testRuntimeOnly("net.bytebuddy:byte-buddy") } diff --git a/orca-clouddriver-provider-titus/orca-clouddriver-provider-titus.gradle b/orca-clouddriver-provider-titus/orca-clouddriver-provider-titus.gradle index 6d92cb0d56..337a5e9cbb 100644 --- a/orca-clouddriver-provider-titus/orca-clouddriver-provider-titus.gradle +++ b/orca-clouddriver-provider-titus/orca-clouddriver-provider-titus.gradle @@ -29,4 +29,5 @@ dependencies { testImplementation(project(":orca-test-groovy")) testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") + testRuntimeOnly("net.bytebuddy:byte-buddy") } diff --git a/orca-echo/orca-echo.gradle b/orca-echo/orca-echo.gradle index c6ab3976e1..3a38547e95 100644 --- a/orca-echo/orca-echo.gradle +++ b/orca-echo/orca-echo.gradle @@ -31,6 +31,7 @@ dependencies { implementation("io.spinnaker.kork:kork-retrofit") testImplementation("com.squareup.retrofit:retrofit-mock") + testRuntimeOnly("net.bytebuddy:byte-buddy") } tasks.withType(Javadoc) { diff --git a/orca-front50/orca-front50.gradle b/orca-front50/orca-front50.gradle index 4b476b74a8..6fdd7c667a 100644 --- a/orca-front50/orca-front50.gradle +++ b/orca-front50/orca-front50.gradle @@ -38,6 +38,7 @@ dependencies { testImplementation(project(":orca-test-groovy")) testImplementation(project(":orca-pipelinetemplate")) testImplementation("com.github.ben-manes.caffeine:guava") + testRuntimeOnly("net.bytebuddy:byte-buddy") } sourceSets { diff --git a/orca-igor/orca-igor.gradle b/orca-igor/orca-igor.gradle index a907cd8ff4..833e11bb0a 100644 --- a/orca-igor/orca-igor.gradle +++ b/orca-igor/orca-igor.gradle @@ -33,6 +33,7 @@ dependencies { testImplementation("org.springframework:spring-test") testImplementation("io.spinnaker.fiat:fiat-core:$fiatVersion") testImplementation("com.github.tomakehurst:wiremock-jre8-standalone") + testRuntimeOnly("net.bytebuddy:byte-buddy") } sourceSets { diff --git a/orca-interlink/orca-interlink.gradle b/orca-interlink/orca-interlink.gradle index 65fb91f590..ef577656c9 100644 --- a/orca-interlink/orca-interlink.gradle +++ b/orca-interlink/orca-interlink.gradle @@ -30,4 +30,5 @@ dependencies { compileOnly("org.projectlombok:lombok") annotationProcessor("org.projectlombok:lombok") testImplementation(project(":orca-test")) + testRuntimeOnly("net.bytebuddy:byte-buddy") } diff --git a/orca-mine/orca-mine.gradle b/orca-mine/orca-mine.gradle index 1b62bf73ac..c982361dfc 100644 --- a/orca-mine/orca-mine.gradle +++ b/orca-mine/orca-mine.gradle @@ -29,6 +29,7 @@ dependencies { testImplementation("org.junit.jupiter:junit-jupiter-params") testImplementation("org.assertj:assertj-core") testImplementation("com.github.tomakehurst:wiremock-jre8-standalone") + testRuntimeOnly("net.bytebuddy:byte-buddy") } sourceSets { diff --git a/orca-peering/orca-peering.gradle b/orca-peering/orca-peering.gradle index da3ea193d7..780a87d5d2 100644 --- a/orca-peering/orca-peering.gradle +++ b/orca-peering/orca-peering.gradle @@ -25,4 +25,5 @@ dependencies { implementation("org.springframework.boot:spring-boot-autoconfigure") testImplementation(project(":orca-test-groovy")) + testRuntimeOnly("net.bytebuddy:byte-buddy") } diff --git a/orca-pipelinetemplate/orca-pipelinetemplate.gradle b/orca-pipelinetemplate/orca-pipelinetemplate.gradle index 7499e79dbd..6a69122df5 100644 --- a/orca-pipelinetemplate/orca-pipelinetemplate.gradle +++ b/orca-pipelinetemplate/orca-pipelinetemplate.gradle @@ -31,4 +31,5 @@ dependencies { testImplementation("org.codehaus.groovy:groovy-json") testImplementation("io.spinnaker.fiat:fiat-core:$fiatVersion") testImplementation("io.spinnaker.kork:kork-retrofit") + testRuntimeOnly("net.bytebuddy:byte-buddy") } diff --git a/orca-webhook/orca-webhook.gradle b/orca-webhook/orca-webhook.gradle index 236edc029e..40433fff74 100644 --- a/orca-webhook/orca-webhook.gradle +++ b/orca-webhook/orca-webhook.gradle @@ -30,6 +30,7 @@ dependencies { implementation("com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0") testImplementation("org.springframework:spring-test") testImplementation("org.codehaus.groovy:groovy-json") + testRuntimeOnly("net.bytebuddy:byte-buddy") implementation("io.spinnaker.fiat:fiat-api:$fiatVersion") implementation("io.spinnaker.fiat:fiat-core:$fiatVersion")