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:kaptGenerateStubsKotlin6 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
⌛
This post has been reserved for your question.
Hey @Hype_the_Time (PING ON REPLY)! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose 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.
bump
i mean you can try changing the kotlin version
to 2.0.21
tried that. issue appeared to be that in that case ksp fails to work
then you need to change the version of that detekt thing
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.
nvm.
detekt worked partially. first thing worked but still failed shortly after:
hmmmmmmm
just change ksp version then
if detekt works
how about
2.0.21-1.0.27
"2.0.21-1.0.19"
try this one
u didnt change the ksp version
show the whole dependencies thing
iull go though the build.gradle.kts again to chekc whether any are no using thje toml
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
yeah. thats in settings.gradle.kts
working on finding out on how to link them too libs.versions.toml.
however ill be gone for like half an hour to an hour
This message has been formatted automatically. You can disable this using
/preferences
.@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
which breakpoint
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)

file not found
l0l
show the path to the file
or
can you try giving it the absolute path
so c:/blalblalballblalbla
the local path property isnt detected properly. the main part here being is i want to view the properties to imrpove its logic
see if thats gonna work
that file doesnt eoixt ik that
ye if it doesnt exist then its normal that it throws file not found
so whats the problem
but thats cus of wrong path being used which i get via logic which i want to debug cus its not working
the property thing not working
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
i mean
did u turn on the debugger
lmao



does this answer the question?
hmmmmmmm
what happens if u start the debugger without all the
extra settings or whatever its called
idk gradle much so yea
no breakpoint hit either. before the detect thingie i needed the like gradle daemon = false. otherwise breakpoints dont work
does it hit the breakpoint at line 82 maybe
nope. i set one in the property thing as well but they dont seem to be loaded or sth. like the arrow never appears
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
tried some basic stuff before i came back to you.
gpt says to try this
./gradlew clean build --no-build-cache
./gradlew bootRun --debug-jvm
neither of the worked
ima try with no daemon flag tho
didnt help either
what if u run without any config
just debugger
i mean no args
wdym
i did that before
onlöy build was done
maybe u gotta clean the build folder
.
oh
my bad
clean bootJar -Dorg.gradle.daemon=false --stacktrace
then what if u dont clean it
lmao
only daemon false
no breakpoint hit as usual
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
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?
daniel waking up on the ping
lets see what tag view says
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 IntelliJ
• Debugging in Eclipse
to my knowledge not useful this time at least
Do you want to debug an annotation processor?
if yes, you need extra arguments to enable debugging
clean bootJar -Dorg.gradle.daemon=false --stacktrace?
that just disables the daemon but it doesn't enable debugging by itself
-Dorg.gradle.debug=true
try adding thatalso 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
)What exactly do you want to do? How are you doing it? What happens?
.
(i want to debug the issue but breakpoint isnt hitting)
debugging gradle
:GnuTrolling:
Yo
Does Gradle wait for you to attach a debugger?
nah. gradle in general ngl
not configured mybe
dont think its needed rn but why not
welp thats timing
try
-Dcompiler.process.debug.port=5005
or actually something like -Dorg.gradle.jvmargs=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
oh wait so you can attach a debugger?
I didn't see the
Connected to the target VM, address: '127.0.0.1:36601', transport: 'socket'
line beforewait
might have removed damon false
though the error is pretty clear with the file not existing, not being accessible or being a directory
mainly its shwoing that its throwing the error immediatley without breakpoint hit
For ksp you might also need
-Dkotlin.compiler.execution.strategy=in-process
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
What happens?
change the
suspend=n
to suspend=y
i think the best solution is to just switch to maven
also tried without the suspend thinie again.
Connected to the target VM, address: '127.0.0.1:45029', transport: 'socket'
still shows this
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 IJit 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
then the
-Dkotlin.compiler.execution.strategy=in-process
probably doesn't work
that's fineCan you run the
kspDebugKotlin
task on the module instead of bootJar
?
also first try it on a minimal project./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
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?
idk what you want to do tbh
changes to last working version
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
💤
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.
bump
Did you do that by now?
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
can you pinpoint which changed thing was the problem and then just show it
if u have the commit difference
s
?
full one above
isnt that just that?
you create a new project that only uses the annotation processor and nothing else
that would be a good start
you mean copy the exact annotation processor to a diff project with saemc lasses etc?
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?
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
it might use different processes for the Kotlin compiler/KSP and Gradle
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
try creating a new project with a ksp and a module using it
and try debugging that
first make sure that works
with breakpoints
i rolled back to just remove detekt and it wroked like before
but since detekt it just stopped
its something with detect probably
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
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.
instead of
-D
, use -P
?
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...
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...
* What went wrong:
Task 'kspDebugKotlin' not found in root project 'BingoNet-Server' and its subprojects.
there's also a
Breakpoints are not hit
section
use whatever the task is named
it may also be :yoursubmodule:kspDebugKotlin
i searched though intelijs gradle tasks. the onlky one i found is kspKotlin and kspTestKolin
then use kspKotlin
./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 FAILEDe: 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
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
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.the strange thing for me is like i didnt change aynthing to yesterday that i could explain it myself with
make sure to run Gradle with JDK 21
or clean the project
ah
you compiled it with IJ before and now you are running it from the CLI which might use a different JDK
so true
set the JAVA_HOME to a JDK 21 installation
?
without
bin/java
also with =
after JAVA_HOME
I assume you are using Linux or MacOS?first
then it should be ok with
export JAVA_HOME=...

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
you can create a run configuration that runs the Gradle command maybe
not greatkly synced and it will always compile without damon then
don't debug with the daemon
you can compile the annotation processor before/you don't need to clean
no. like when debvugginbg fine but for normal compilation its slower unecessarily
you can sstill compile normally
just for debugging, you need the other command
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?
Is
AddAutoReportLogicModalImplementation
a class?yes
one that has an annotation and is being processed
ah closing reset the notifications settings ic
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?
logger.error("Failed to generate for ${ksClass.simpleName.asString()}: ${e.message}")
I did NOT rember that.
then that's where it's coming from
consider printing the whole stack trace via debug logging or similar
welp changed it to also print the stacktrace now
💤
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.