Custom kotlin dependency indexing
已回答
I have a gradle project and a kotlin file in different locations.
Is it possible to make Intellij IDEA index the dependencies from the gradle project in the kotlin file by some setting or by a plugin?
请先登录再写评论。
Kotlin source muse belong to the same Gradle project.
If the location is different and you can't change it, you can instruct Gradle to load sources from non-default locations.
https://stackoverflow.com/questions/31077844/add-another-java-source-directory-to-gradle-script
Serge Baranov But if I open the sources, I have no suggestions related to the dependencies of the gradle project placed elsewhere.
>But if I open the sources, I have no suggestions related to the dependencies of the gradle project placed elsewhere.
Not sure I understand. Can you please elaborate.
Andrey Dernov I want to link kotlin sources with a remote gradle project (in another directory). I can point gradle to the sources, but I open the sources as a separate project in intellij idea.
Given I have a source in some directory called src2 and I add it like following in my project:
sourceSets {main {
java {
srcDirs 'src2'
}
}
}
I am able to use the code in my main source set (src/main/java) in the src2 directory.
What is your setup and what is the exact problem?
Note that in a Gradle project you should follow Gradle "rules" for managing the project structure. So provided that it works in Gradle - it will work in IntelliJ IDEA.