detekt was compiled with Kotlin 2.0.21 but is currently running with 2.2.0-RC2.

I have been trying to set up detekt. but get this error. IMPORTANT they link to their website it seems: https://detekt.dev/docs/gettingstarted/gradle#dependencies but i dont understand enough from it and gpt isn't helping either. 09:07:10: Executing 'build'… Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
Task :annotation-proccessor:checkKotlinGradlePluginConfigurationErrors SKIPPED Task :shared-annotation-proccessor:checkKotlinGradlePluginConfigurationErrors SKIPPED Task :shared-annotation-proccessor:processResources UP-TO-DATE Task :main:checkKotlinGradlePluginConfigurationErrors SKIPPED Task :detekt-rules:checkKotlinGradlePluginConfigurationErrors SKIPPED Task :detekt-rules:processResources UP-TO-DATE Task :detekt-rules:compileKotlin Task :detekt-rules:compileJava NO-SOURCE Task :detekt-rules:classes UP-TO-DATE Task :detekt-rules:jar UP-TO-DATE Task :main:detekt FAILED Task :shared-annotation-proccessor:kaptGenerateStubsKotlin
6 actionable tasks: 3 executed, 3 up-to-date FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':main:detekt'.
detekt was compiled with Kotlin 2.0.21 but is currently running with 2.2.0-RC2.
This is not supported. See https://detekt.dev/docs/gettingstarted/gradle#dependencies for more information. * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
BUILD FAILED in 1s 09:07:12: Execution finished 'build'.
Run detekt using the Detekt Gradle Plugin | detekt
detekt requires Gradle 6.8.3 or higher. We, however, recommend using the version of Gradle that is listed in this table.
146 Replies
JavaBot
JavaBot3mo ago
This post has been reserved for your question.
Hey @Hype_the_Time (PING ON REPLY)! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
ayylmao123xdd
ayylmao123xdd3mo ago
i mean you can try changing the kotlin version to 2.0.21
Hype_the_Time (PING ON REPLY)
tried that. issue appeared to be that in that case ksp fails to work
ayylmao123xdd
ayylmao123xdd3mo ago
then you need to change the version of that detekt thing
Hype_the_Time (PING ON REPLY)
lets go though everything again. so lets change kotlin in the libs.versions.toml over to 2.0.21 HUH. i only changed the kotlin vuale. now it worked huh? cus i didnt change over ksp? i mean tehcniocally this is still here but it works??? ksp-2.2.0-RC2-2.0.2 is too new for kotlin-2.0.21. Please upgrade kotlin-gradle-plugin to 2.2.0-RC2. ksp-2.2.0-RC2-2.0.2 is too new for kotlin-2.0.21. Please upgrade kotlin-gradle-plugin to 2.2.0-RC2. ksp-2.2.0-RC2-2.0.2 is too new for kotlin-2.0.21. Please upgrade kotlin-gradle-plugin to 2.2.0-RC2. ksp-2.2.0-RC2-2.0.2 is too new for kotlin-2.0.21. Please upgrade kotlin-gradle-plugin to 2.2.0-RC2.
Hype_the_Time (PING ON REPLY)
nvm. detekt worked partially. first thing worked but still failed shortly after:
ayylmao123xdd
ayylmao123xdd3mo ago
hmmmmmmm just change ksp version then if detekt works
Hype_the_Time (PING ON REPLY)
how about 2.0.21-1.0.27
ayylmao123xdd
ayylmao123xdd3mo ago
"2.0.21-1.0.19" try this one
ayylmao123xdd
ayylmao123xdd3mo ago
u didnt change the ksp version show the whole dependencies thing
Hype_the_Time (PING ON REPLY)
iull go though the build.gradle.kts again to chekc whether any are no using thje toml
ayylmao123xdd
ayylmao123xdd3mo ago
just check where u have this 2.2.0 version and replace on every occurence or maybe ur using the latest version thing or whatever its called in gradle so it doesnt show u exact version
Hype_the_Time (PING ON REPLY)
yeah. thats in settings.gradle.kts
Hosti
Hosti3mo ago
working on finding out on how to link them too libs.versions.toml.
plugins {
kotlin("jvm") version "latest.release"
kotlin("kapt") version "latest.release"
id("com.google.devtools.ksp") version "latest.release"
}
plugins {
kotlin("jvm") version "latest.release"
kotlin("kapt") version "latest.release"
id("com.google.devtools.ksp") version "latest.release"
}
however ill be gone for like half an hour to an hour
This message has been formatted automatically. You can disable this using /preferences.
Hype_the_Time (PING ON REPLY)
@ayylmao123xdd I changed it over to libs.versions.toml and seems to work decetnly. however i have a breakpoint that doesnt hit when i want to debug it. normally i just used clean bootJar -Dorg.gradle.daemon=false --stacktrace
ayylmao123xdd
ayylmao123xdd3mo ago
which breakpoint
Hype_the_Time (PING ON REPLY)
e: [ksp] java.io.FileNotFoundException: /home/spieler/.local/share/kotlin/daemon/neu-repo/constants/minions.json (Datei oder Verzeichnis nicht gefunden) at java.base/java.io.FileInputStream.open0(Native Method) at java.base/java.io.FileInputStream.open(FileInputStream.java:213) at java.base/java.io.FileInputStream.<init>(FileInputStream.java:152) at kotlin.io.FilesKtFileReadWriteKt.readText(FileReadWrite.kt:131) at kotlin.io.FilesKtFileReadWriteKt.readText$default(FileReadWrite.kt:131) at de.hype.bingonet.shared.compilation.sbenums.minions.MinionRepoManager.minionTypes_delegate$lambda$13(MinionRepoManager.kt:84) at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74) at de.hype.bingonet.shared.compilation.sbenums.minions.MinionRepoManager.getMinionTypes(MinionRepoManager.kt:81)
No description
ayylmao123xdd
ayylmao123xdd3mo ago
file not found l0l show the path to the file or can you try giving it the absolute path so c:/blalblalballblalbla
Hype_the_Time (PING ON REPLY)
the local path property isnt detected properly. the main part here being is i want to view the properties to imrpove its logic
ayylmao123xdd
ayylmao123xdd3mo ago
see if thats gonna work
Hype_the_Time (PING ON REPLY)
that file doesnt eoixt ik that
ayylmao123xdd
ayylmao123xdd3mo ago
ye if it doesnt exist then its normal that it throws file not found so whats the problem
Hype_the_Time (PING ON REPLY)
but thats cus of wrong path being used which i get via logic which i want to debug cus its not working
ayylmao123xdd
ayylmao123xdd3mo ago
the property thing not working
Hype_the_Time (PING ON REPLY)
i want to debug the property but i cant and i want to show that its not n ot being used like the issue is the breakpoint isnt "registering" the exception is totally fair and to be exypected
ayylmao123xdd
ayylmao123xdd3mo ago
i mean did u turn on the debugger lmao
Hype_the_Time (PING ON REPLY)
does this answer the question?
ayylmao123xdd
ayylmao123xdd3mo ago
hmmmmmmm what happens if u start the debugger without all the extra settings or whatever its called idk gradle much so yea
Hype_the_Time (PING ON REPLY)
no breakpoint hit either. before the detect thingie i needed the like gradle daemon = false. otherwise breakpoints dont work
ayylmao123xdd
ayylmao123xdd3mo ago
does it hit the breakpoint at line 82 maybe
Hype_the_Time (PING ON REPLY)
nope. i set one in the property thing as well but they dont seem to be loaded or sth. like the arrow never appears
ayylmao123xdd
ayylmao123xdd3mo ago
thats weird seems to be some issue with gradle cuz like i test rn with maven and seems to work i think u have to mess around with the debug config or ask some llm
Hype_the_Time (PING ON REPLY)
tried some basic stuff before i came back to you.
ayylmao123xdd
ayylmao123xdd3mo ago
gpt says to try this ./gradlew clean build --no-build-cache ./gradlew bootRun --debug-jvm
Hype_the_Time (PING ON REPLY)
neither of the worked ima try with no daemon flag tho didnt help either
ayylmao123xdd
ayylmao123xdd3mo ago
what if u run without any config just debugger i mean no args
Hype_the_Time (PING ON REPLY)
wdym i did that before onlöy build was done
ayylmao123xdd
ayylmao123xdd3mo ago
maybe u gotta clean the build folder
ayylmao123xdd
ayylmao123xdd3mo ago
oh my bad
Hype_the_Time (PING ON REPLY)
clean bootJar -Dorg.gradle.daemon=false --stacktrace
ayylmao123xdd
ayylmao123xdd3mo ago
then what if u dont clean it lmao only daemon false
Hype_the_Time (PING ON REPLY)
no breakpoint hit as usual
ayylmao123xdd
ayylmao123xdd3mo ago
can you try that on the code startup line where it runs the app if it doesnt catch it there then the problem is with the debugger
Hype_the_Time (PING ON REPLY)
uhhhh its ksp so maybe the ksp processor provider? but there is no starigh up main afaik with my default thing it didnt regiter them as usual but if i test everything before this is gonna get recursive @dan1st you told me on how to get debug working last time. any ideas?
ayylmao123xdd
ayylmao123xdd3mo ago
daniel waking up on the ping lets see what tag view says
JavaBot
JavaBot3mo ago
It looks like you are having issues with debugging or issues that can be solved using a debugger. Check out this article on dev.java to see how debugging works and how to use a debugger. This Stack Overflow question and its answers also explain debugging in general. These links describe how to use the debugger in some IDEs: • Debugging in IntelliJDebugging in Eclipse
Hype_the_Time (PING ON REPLY)
to my knowledge not useful this time at least
dan1st
dan1st3mo ago
Do you want to debug an annotation processor? if yes, you need extra arguments to enable debugging
Hype_the_Time (PING ON REPLY)
clean bootJar -Dorg.gradle.daemon=false --stacktrace?
dan1st
dan1st3mo ago
that just disables the daemon but it doesn't enable debugging by itself -Dorg.gradle.debug=true try adding that
Hype_the_Time (PING ON REPLY)
also i just realised. i debuged this previously but detected bricked it probably didnt work. (clean bootJar -Dorg.gradle.daemon=false --stacktrace -Dorg.gradle.debug=true)
dan1st
dan1st3mo ago
What exactly do you want to do? How are you doing it? What happens?
Hype_the_Time (PING ON REPLY)
. (i want to debug the issue but breakpoint isnt hitting)
ayylmao123xdd
ayylmao123xdd3mo ago
debugging gradle :GnuTrolling:
ᴊᴏɴᴀꜱ
ᴊᴏɴᴀꜱ3mo ago
Yo
dan1st
dan1st3mo ago
Does Gradle wait for you to attach a debugger?
Hype_the_Time (PING ON REPLY)
nah. gradle in general ngl not configured mybe
Hype_the_Time (PING ON REPLY)
dont think its needed rn but why not
Hype_the_Time (PING ON REPLY)
welp thats timing
dan1st
dan1st3mo ago
try -Dcompiler.process.debug.port=5005 or actually something like -Dorg.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
dan1st
dan1st3mo ago
oh wait so you can attach a debugger?
dan1st
dan1st3mo ago
I didn't see the Connected to the target VM, address: '127.0.0.1:36601', transport: 'socket' line before
Hype_the_Time (PING ON REPLY)
wait might have removed damon false
dan1st
dan1st3mo ago
though the error is pretty clear with the file not existing, not being accessible or being a directory
Hype_the_Time (PING ON REPLY)
mainly its shwoing that its throwing the error immediatley without breakpoint hit
dan1st
dan1st3mo ago
For ksp you might also need -Dkotlin.compiler.execution.strategy=in-process
Hype_the_Time (PING ON REPLY)
17:30:51: Executing 'clean bootJar -Dorg.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process'… Instant fail still
dan1st
dan1st3mo ago
What happens?
dan1st
dan1st3mo ago
change the suspend=n to suspend=y
ayylmao123xdd
ayylmao123xdd3mo ago
i think the best solution is to just switch to maven
Hype_the_Time (PING ON REPLY)
also tried without the suspend thinie again. Connected to the target VM, address: '127.0.0.1:45029', transport: 'socket' still shows this
dan1st
dan1st3mo ago
that'd just be mvnDebug instead of mvn - or mvn --debug I specifically meant suspend=y also run the command in a proper terminal not inside IJ
Hype_the_Time (PING ON REPLY)
it waited for me to attacth it but still didnt upload the breakpoints or sth????? To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build
dan1st
dan1st3mo ago
then the -Dkotlin.compiler.execution.strategy=in-process probably doesn't work that's fine
dan1st
dan1st3mo ago
Can you run the kspDebugKotlin task on the module instead of bootJar? also first try it on a minimal project
Hype_the_Time (PING ON REPLY)
./gradlew clean kspDebugKotlin -Dorg.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Dorg.gradle.daemon=false -Dkotlin.compiler.execution.strategy=in-process To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build FAILURE: Build failed with an exception. * What went wrong: Task 'kspDebugKotlin' not found in root project 'BingoNet-Server' and its subprojects. * Try:
Run gradlew tasks to get a list of available tasks. For more on name expansion, please refer to https://docs.gradle.org/8.5/userguide/command_line_interface.html#sec:name_abbreviation in the Gradle documentation. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
BUILD FAILED in 13s
Hype_the_Time (PING ON REPLY)
i have an idea. i had debug onto this before. i think if i go back a couple commits i can get it to "halt" and then send patch list if that useful?
dan1st
dan1st3mo ago
idk what you want to do tbh
Hype_the_Time (PING ON REPLY)
changes to last working version
Hype_the_Time (PING ON REPLY)
in case its useful these are only the things i associate with gradle in some shape or form: all of them also included in the 1 before. this is only gradle ones
JavaBot
JavaBot3mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
dan1st
dan1st3mo ago
Did you do that by now?
Hype_the_Time (PING ON REPLY)
i dont know what you are thinking of there exactly. like the project is so complex that i honestly dont know why you mean with minimal project tbh. like do i need to include classes? which ones? isnt that gonna explode due to dependencies of dependencies etc. also what does a minimal project provide different to a change list that causes it not to work? like isnt there just a tiny differnce? (→ isnt a minimal project trying to aim at the differnce between the working and non working? doesnt a change list do that part too?) since the change lists arent that big either
ayylmao123xdd
ayylmao123xdd3mo ago
can you pinpoint which changed thing was the problem and then just show it if u have the commit difference s
Hype_the_Time (PING ON REPLY)
? full one above isnt that just that?
dan1st
dan1st3mo ago
you create a new project that only uses the annotation processor and nothing else that would be a good start
Hype_the_Time (PING ON REPLY)
you mean copy the exact annotation processor to a diff project with saemc lasses etc?
dan1st
dan1st3mo ago
only what's necessary for reproducing the issue actually: Are you asking about how you can attach a debugger or how to fix the specific issue?
Hype_the_Time (PING ON REPLY)
i mean it seemed like it just completely disregarded the breakpoints. i mean it waited for debugger to atatch earlier but it just didnt activate the breakpoints and it works if i undo the patches above and they didnt show with the checkmark for uploaded or sth
dan1st
dan1st3mo ago
it might use different processes for the Kotlin compiler/KSP and Gradle
Hype_the_Time (PING ON REPLY)
something like that was my assumption but i have nop idea what it is. i set the parallel to false as you can see above and i set debug to true. thats all i can think off
dan1st
dan1st3mo ago
try creating a new project with a ksp and a module using it and try debugging that first make sure that works with breakpoints
Hype_the_Time (PING ON REPLY)
i rolled back to just remove detekt and it wroked like before but since detekt it just stopped its something with detect probably
dan1st
dan1st3mo ago
the argument setting the execution strategy to in-process should fix it - but that might be the thing that doesn't work then try with a project using only detekt and a ksp oh
Hype_the_Time (PING ON REPLY)
i still dont really have a clue on what you expect essentially. never did a minimal project or sth and I do not understand what i should do that would make it any different to the patch list.
dan1st
dan1st3mo ago
instead of -D, use -P
Hype_the_Time (PING ON REPLY)
clean bootJar -Dorg.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Dorg.gradle.daemon=false -Pkotlin.compiler.execution.strategy=in-process
clean bootJar -Dorg.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -Dorg.gradle.daemon=false -Pkotlin.compiler.execution.strategy=in-process
?
dan1st
dan1st3mo ago
https://pelsmaeker.net/articles/debugging-ksp-gradle-plugin/
./gradlew kspDebugKotlin --rerun -Dorg.gradle.debug=true --no-daemon -Pkotlin.compiler.execution.strategy=in-process
./gradlew kspDebugKotlin --rerun -Dorg.gradle.debug=true --no-daemon -Pkotlin.compiler.execution.strategy=in-process
Daniel A. A. Pelsmaeker
How to debug a KSP Gradle plugin
When writing a Kotlin Symbol Processor (KSP) plugin for Gradle, it is invaluable to be able to debug your code. In this short article I will show how to set this up properly using Gradle 7.6 and Kotlin 1.8.0, with remote debugging through IntelliJ 2022.3.1, but these instructions should also work for newer versions. To debug our KSP code, we nee...
dan1st
dan1st3mo ago
but since Kotlin 1.7 this is a Gradle property (to be specified with the -P option or in the gradle.properties file), and since Kotlin 1.8 the system property has been removed and has no effect.
https://pelsmaeker.net/articles/debugging-ksp-gradle-plugin/#ensuring-ksp-is-executed-in-the-same-process
Daniel A. A. Pelsmaeker
How to debug a KSP Gradle plugin
When writing a Kotlin Symbol Processor (KSP) plugin for Gradle, it is invaluable to be able to debug your code. In this short article I will show how to set this up properly using Gradle 7.6 and Kotlin 1.8.0, with remote debugging through IntelliJ 2022.3.1, but these instructions should also work for newer versions. To debug our KSP code, we nee...
Hype_the_Time (PING ON REPLY)
* What went wrong: Task 'kspDebugKotlin' not found in root project 'BingoNet-Server' and its subprojects.
dan1st
dan1st3mo ago
there's also a Breakpoints are not hit section use whatever the task is named it may also be :yoursubmodule:kspDebugKotlin
Hype_the_Time (PING ON REPLY)
i searched though intelijs gradle tasks. the onlky one i found is kspKotlin and kspTestKolin
dan1st
dan1st3mo ago
then use kspKotlin
Hype_the_Time (PING ON REPLY)
./gradlew kspKotlin --rerun -Dorg.gradle.debug=true --no-daemon -Pkotlin.compiler.execution.strategy=in-process To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.5/userguide/gradle_daemon.html#sec:disabling_the_daemon in the Gradle documentation. Daemon will be stopped at the end of the build Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
Task :annotation-proccessor:kspKotlin FAILED
e: java.lang.UnsupportedClassVersionError: de/hype/bingonet/shared/compilation/processors/MinionEnumGeneratorsProvider has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0
dan1st
dan1st3mo ago
I'm neither use Gradle nor Kotlin (hence also no KSP, only Java annotation processors) so idk the commands you are using the wrong Java version
JavaBot
JavaBot3mo ago
When compiling Java applications to .class files, javac adds an integer representing the version it has been compiled for to the class file. Each Java version has a class file (major) version associated with it. A list with Java versions and the matching class file major version numbers can be found in this Stack Overflow question. In order to use a class, the JVM must be of a newer or equal version to the one specified in the class file.
Hype_the_Time (PING ON REPLY)
the strange thing for me is like i didnt change aynthing to yesterday that i could explain it myself with
dan1st
dan1st3mo ago
make sure to run Gradle with JDK 21 or clean the project
dan1st
dan1st3mo ago
you compiled it with IJ before and now you are running it from the CLI which might use a different JDK
ayylmao123xdd
ayylmao123xdd3mo ago
so true
dan1st
dan1st3mo ago
set the JAVA_HOME to a JDK 21 installation
Hype_the_Time (PING ON REPLY)
export JAVA_HOME=~/.jdks/jbr_jcef-21.0.3-linux-x64-b509.4/
export JAVA_HOME=~/.jdks/jbr_jcef-21.0.3-linux-x64-b509.4/
?
dan1st
dan1st3mo ago
without bin/java also with = after JAVA_HOME I assume you are using Linux or MacOS?
dan1st
dan1st3mo ago
then it should be ok with export JAVA_HOME=...
Hype_the_Time (PING ON REPLY)
any ideas on how to make it so the debug stuff is automatically done on intelij debug while normal compilation goes as fast as possible with parallel? cus i fear loosing it or not having it on other devices if not git synced yk
dan1st
dan1st3mo ago
you can create a run configuration that runs the Gradle command maybe
Hype_the_Time (PING ON REPLY)
not greatkly synced and it will always compile without damon then
dan1st
dan1st3mo ago
don't debug with the daemon you can compile the annotation processor before/you don't need to clean
Hype_the_Time (PING ON REPLY)
no. like when debvugginbg fine but for normal compilation its slower unecessarily
dan1st
dan1st3mo ago
you can sstill compile normally just for debugging, you need the other command
Hype_the_Time (PING ON REPLY)
e: [ksp] Failed to generate for AddAutoReportLogicModalImplementation: Invalid featureType this isnt that descriptive. any ideas on how i can make it give me like actually useful data like stacktrace etc?
dan1st
dan1st3mo ago
Is AddAutoReportLogicModalImplementation a class?
Hype_the_Time (PING ON REPLY)
yes one that has an annotation and is being processed ah closing reset the notifications settings ic
dan1st
dan1st3mo ago
I think it's an error coming directly from your annotation processor Can you search fro the text "Failed to generate for" in your code?
Hype_the_Time (PING ON REPLY)
logger.error("Failed to generate for ${ksClass.simpleName.asString()}: ${e.message}") I did NOT rember that.
dan1st
dan1st3mo ago
then that's where it's coming from consider printing the whole stack trace via debug logging or similar
Hype_the_Time (PING ON REPLY)
welp changed it to also print the stacktrace now
JavaBot
JavaBot3mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.

Did you find this page helpful?