Hi. I'm a little disappointed in how little help ...
# gradle
h
Hi. I'm a little disappointed in how little help I get from IntelliJ after switching to kotlin-dsl. For example this snippet:
Copy code
tasks {
    val moduleTest by existing(Test::class) {
        setForkEvery(1)
    }
}
I'm not able to navigate to the
Test
class or to
setForkEvery
, and I don't get a list of other methods are available besides
setForkEvery
. Is there anything I can do to improve the situation?
g
I don’t know if this help you, but when you configure gradle tasks inside intellij (using run configurations) you should be able to put breakpoints and inspect your code. But, if the navigation is not working this might not help too much. Did you enabled the auto reload support? In my case I have classes inside my buildSrc module and I can use autocompletion and navigation.
Also we have a gradle slack and usually the folks there are really kind giving suggestions. I’ve seen now that you posted there.
h
I don't use auto-reload, but click on reload whenever I need to. I'm able to navigate to Libs and Versions (and everything else) in buildSrc, but not to anything in the Gradle API.
t
what gradle distribution are you using -
bin
or
all
?
g
Hum, I think you need to add this thing here in your build.gradle.kts inside build.src
compile("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
Also this in the repositories (I also have in my settings.gradle.kts, but I don’t know if its going to be needed for you or not)
gradlePluginPortal()
h
@tapchicoma: I'm using
all
@GarouDan Adding
kotlin-gradle-plugin
to buildSrc dependencies didn't help. And I've already got
gradlePluginPortal()
in
buildscript
g
Is this class here?
.../.gradle/caches/transforms-2/files-2.1/.../unzipped-distribution/gradle-5.6.2/subprojects/testing-jvm/src/main/java/org/gradle/api/tasks/testing/Test.java
If yes I can navigate to it
h
There's no
unzipped-distribution
anywhere in
~/.gradle/caches/
Also
~/.gradle/caches/transforms-2/files-2.1/
is empty
g
I don’t know how to solve your problem, but probably is because of that you don’t have autocompletion. You will probably need to add the needed classpath dependencies in your project to have something in your
~/gradle/
and then use the proper autocompletion. This is my guess
h
I have:
Copy code
plugins {
   `kotlin-dsl`
}
... in
buildSrc/build.gradle.kts
, and ..
Copy code
buildscript { 
  dependencies {
      classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50") 
      ...
   }
}
apply(plugin = "kotlin")

dependencies {
   compile("org.jetbrains.kotlin:kotlin-stdlib:1.3.50")
   compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50")
   ...
}
... in my regular
build.gradle.kts
Shouldn't that be sufficient? I guess I should create a demo project, this is a pretty large multiproject build with loads of gradle config (also mixed groovy/kotlin config at the time being)
Deleting all ipr/iml/iws config files and reimporting the project helped! Thanks a lot for your patience 🙂
message has been deleted