Open anubhavjain24 opened 1 year ago
/cc @evanchooly (kotlin), @geoand (kotlin), @glefloch, @quarkusio/devtools
I think this has already been reported but I can't find it right now.
cc @gsmet
@ia3andy could you have a look at this one? At a quick glance, it seems to be in your ballpark.
Any fix for above issue ?
Also getting below error while running tests
java.lang.instrument.IllegalClassFormatException: Error while instrumenting io/quarkus/test/common/TestResourceManager with JaCoCo 0.8.9.202303310957/c0ad781.
at org.jacoco.agent.rt.internal_4481564.CoverageTransformer.transform(CoverageTransformer.java:94)
at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:506)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:227)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:592)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:640)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:110)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:90)
at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:85)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:62)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
at jdk.proxy2/jdk.proxy2.$Proxy5.stop(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:113)
at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:65)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: java.io.IOException: Error while instrumenting io/quarkus/test/common/TestResourceManager with JaCoCo 0.8.9.202303310957/c0ad781.
at org.jacoco.agent.rt.internal_4481564.core.instr.Instrumenter.instrumentError(Instrumenter.java:161)
at org.jacoco.agent.rt.internal_4481564.core.instr.Instrumenter.instrument(Instrumenter.java:111)
at org.jacoco.agent.rt.internal_4481564.CoverageTransformer.transform(CoverageTransformer.java:92)
... 69 more
Caused by: java.lang.IllegalStateException: Cannot process instrumented class io/quarkus/test/common/TestResourceManager. Please supply original non-instrumented classes.
at org.jacoco.agent.rt.internal_4481564.core.internal.instr.InstrSupport.assertNotInstrumented(InstrSupport.java:238)
at org.jacoco.agent.rt.internal_4481564.core.internal.instr.ClassInstrumenter.visitMethod(ClassInstrumenter.java:65)
at org.jacoco.agent.rt.internal_4481564.core.internal.flow.ClassProbesAdapter.visitMethod(ClassProbesAdapter.java:66)
at org.jacoco.agent.rt.internal_4481564.asm.ClassReader.readMethod(ClassReader.java:1353)
at org.jacoco.agent.rt.internal_4481564.asm.ClassReader.accept(ClassReader.java:744)
at org.jacoco.agent.rt.internal_4481564.asm.ClassReader.accept(ClassReader.java:424)
at org.jacoco.agent.rt.internal_4481564.core.instr.Instrumenter.instrument(Instrumenter.java:91)
at org.jacoco.agent.rt.internal_4481564.core.instr.Instrumenter.instrument(Instrumenter.java:109)
... 70 more
java.lang.instrument.IllegalClassFormatException: Error while instrumenting io/quarkus/test/common/TestStatus with JaCoCo 0.8.9.202303310957/c0ad781.
at org.jacoco.agent.rt.internal_4481564.CoverageTransformer.transform(CoverageTransformer.java:94)
at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
at java.base/java.lang.ClassLoader.defineClass1(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:506)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at io.quarkus.test.common.TestResourceManager.
same problem:
Caused by: io.quarkus.devtools.commands.data.QuarkusCommandException: Error while running the project update script at io.quarkus.devtools.commands.handlers.UpdateProjectCommandHandler.execute(UpdateProjectCommandHandler.java:102) at io.quarkus.devtools.commands.UpdateProject.execute(UpdateProject.java:83) at io.quarkus.gradle.tasks.QuarkusUpdate.logUpdates(QuarkusUpdate.java:156) ... 117 more Caused by: io.quarkus.devtools.project.update.QuarkusUpdateException: gradle-kotlin-dsl is not supported yet at io.quarkus.devtools.project.update.QuarkusUpdateCommand.handle(QuarkusUpdateCommand.java:51) at io.quarkus.devtools.commands.handlers.UpdateProjectCommandHandler.execute(UpdateProjectCommandHandler.java:92) ... 119 more
As explained in the log: "gradle-kotlin-dsl is not supported yet", AFAIK OpenRewrite doesn't yet support Gradle with Kotlin DSL.
@anubhavjain24 in the issue logs I also see: The project does not import any Quarkus platform BOM
this is because the project is using the legacy quarkus bom which should be replaced by io.quarkus.platform:quarkus-bom
.
As explained in the log: "gradle-kotlin-dsl is not supported yet", AFAIK OpenRewrite doesn't yet support Gradle with Kotlin DSL.
Wrong statement it seems they do, I need to check again but last time I tested, our recipe didn't work with Kotlin DSL for some reason I don't remember.
@ia3andy are there plans to make it work with kotlin DSL in the near future? As I'm struggling with the manual upgrade I'm considering if it's worth moving back to Groovy. (Currently it's mixed which causes it's own exception when running the script, so I'd have to move in one or the other direction anyways). If not I suggest mention that in the gradle-tooling guide to warn new projects about kotlin DSL not being supported for this feature as well as in the upgrade guides.
@AdrianAulbach I can't find a similar article for Gradle with Kotlin: https://docs.openrewrite.org/running-recipes/running-rewrite-on-a-gradle-project-without-modifying-the-build
I need the init script if we want to support Gradle with Kotlin.
@ia3andy sorry, I missed the notification
I don't need it necessarily to work with Kotlin, it's just helpful to know that it won't be supported (or at least any time soon) so we can decide to move back to groovy (and don't start new projects with Kotlin DSL).
So my suggestion would be to update https://quarkus.io/guides/gradle-tooling and discourage using Kotlin DSL with the warning that it's not supported by OpenRewrite / quarkus update)
@AdrianAulbach this is not as final as this :)
FYI I will soon initiate a discussion with the OpenRewrite team to see if they have or can do something to help us solve this problem.
Here is the upstream issue: https://github.com/openrewrite/rewrite-docs/issues/234
Still getting the error Caused by: io.quarkus.devtools.project.update.rewrite.QuarkusUpdateException: gradle-kotlin-dsl is not supported yet Anyone figured it out in the meantime if it's possible?
Can Quarkus team update the doc to mention that quarkus update
doesn't support Kotlin DSL yet, to give a proper warning?
Describe the bug
Below is the o/p of gradle update command
quarkus update --stream=3.0
BUILD SUCCESSFUL in 12s
my gradle. properties
quarkusPluginId=io.quarkus quarkusPluginVersion=3.0.1.Final quarkusPlatformGroupId=io.quarkus quarkusPlatformArtifactId=quarkus-universe-bom quarkusPlatformVersion=3.0.1.Final
build.gradle.kts plugins { kotlin("jvm") version "1.8.10" kotlin("plugin.allopen") version "1.8.10" id("io.quarkus") id("org.sonarqube") version "4.0.0.2929" id("org.owasp.dependencycheck") version "8.2.1" jacoco }
repositories { mavenCentral() mavenLocal() }
val quarkusPlatformGroupId: String by project val quarkusPlatformArtifactId: String by project val quarkusPlatformVersion: String by project
dependencies { implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")) implementation(enforcedPlatform("org.jetbrains.kotlin:kotlin-bom:1.8.10")) implementation("io.quarkus:quarkus-container-image-docker") implementation("io.quarkus:quarkus-smallrye-openapi") implementation("io.quarkus:quarkus-kotlin") implementation("io.quarkus:quarkus-resteasy") implementation("io.quarkus:quarkus-resteasy-jackson") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("io.quarkus:quarkus-arc") implementation("com.zaxxer:HikariCP:5.0.1") implementation("org.apache.commons:commons-lang3:3.12.0") implementation("com.microsoft.sqlserver:mssql-jdbc:11.2.2.jre8") implementation("io.quarkus:quarkus-smallrye-health") implementation(enforcedPlatform("software.amazon.awssdk:bom:2.18.38")) implementation("software.amazon.awssdk:secretsmanager") implementation("software.amazon.awssdk:sts")
}
java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 }
allOpen { annotation("javax.ws.rs.Path") annotation("jakarta.enterprise.context.ApplicationScoped") annotation("io.quarkus.test.junit.QuarkusTest") }
tasks.withType {
kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
kotlinOptions.javaParameters = true
}
jacoco { toolVersion = "0.8.9" }
tasks.compileTestKotlin { kotlinOptions { jvmTarget = JavaVersion.VERSION_11.toString() } }
tasks.test { outputs.file(layout.buildDirectory.file("reports/jacoco/test/jacoco.xml")) finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run } tasks.jacocoTestReport { dependsOn(tasks.test) // tests are required to run before generating the report reports{ xml.required.set(true) xml.outputLocation.set(layout.buildDirectory.file("reports/jacoco/test/jacoco.xml")) } } tasks.jacocoTestCoverageVerification { violationRules { rule { limit { minimum = "0.8".toBigDecimal() } } } }
settings.gradle.kts
pluginManagement { val quarkusPluginVersion: String by settings val quarkusPluginId: String by settings repositories { mavenLocal() mavenCentral() gradlePluginPortal() } plugins { id(quarkusPluginId) version quarkusPluginVersion } }
Expected behavior
quarkus update changes should be applied
Actual behavior
Quarlkus not updating. Manually updated gradle.properties
How to Reproduce?
No response
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
Old Version : 2.16.5.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)------------------------------------------------------------ Gradle 8.0.2 ------------------------------------------------------------ Build time: 2023-03-03 16:41:37 UTC Revision: 7d6581558e226a580d91d399f7dfb9e3095c2b1d Kotlin: 1.8.10 Groovy: 3.0.13 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 17.0.7 (Oracle Corporation 17.0.7+8-LTS-224) OS: Windows 10 10.0 amd64
Additional information
No response