0

I'm currently working on a Kotlin project with Gradle (source code here). It's a Bukkit plugin which depends on a library I maintain (library source code here). When running ./gradlew assemble in a terminal, everything works fine and the build succeeds (log below).

$ ./gradlew assemble --console plain

> Task :compileKotlin
w: Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath
w: /home/axel/.gradle/caches/modules-2/files-2.1/com.github.axelrindle/PocketKnife/v1.3.0/b2303013bfd8e21c419f1d640ef374afc48e86af/PocketKnife-v1.3.0.jar: Library has Kotlin runtime bundled into it

> Task :compileJava NO-SOURCE
> Task :processResources
> Task :classes
> Task :inspectClassesForKotlinIC
> Task :jar
> Task :assemble

BUILD SUCCESSFUL in 5s
4 actionable tasks: 4 executed

But when working in IDEA, my library is the only one the IDE fails to resolve for whatever reason.

I've already tried the following steps:

  • Delete gradle/idea caches (~/.gradle/caches;.idea)
  • Reinstall IDEA
  • Delete IDEA config directory (.IdeaIC2019.1)
  • Reimport the project in IDEA

I've already read the following questions/answers, but none of them worked:

Also, my idea.log can be found here: https://pastebin.com/0Z5b3Wdp

Last but not least some version information:

IntelliJ IDEA 2019.1.3 (Community Edition)
Build #IC-191.7479.19, built on May 28, 2019
JRE: 1.8.0_202-release-1483-b58 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.18.0-21-generic
$ ./gradlew --version

------------------------------------------------------------
Gradle 5.4.1
------------------------------------------------------------

Build time:   2019-04-26 08:14:42 UTC
Revision:     261d171646b36a6a28d5a19a69676cd098a4c19d

Kotlin:       1.3.21
Groovy:       2.5.4
Ant:          Apache Ant(TM) version 1.9.13 compiled on July 10 2018
JVM:          12.0.1 (Oracle Corporation 12.0.1+12)
OS:           Linux 4.18.0-21-generic amd64

Axel
  • 568
  • 7
  • 18
  • @Anatolii As i mentioned, i already tried deleting the whole `.idea` directory and reimporting afterwards. Doesn't work. – Axel Jun 15 '19 at 14:32
  • @Axel I just cloned your repository and successfully executed build->assemble within IntelliJ. Could you try to clone your repository in another directory and try it again? – hce Jun 15 '19 at 21:50
  • @Axel Also can you provide your idea.log? Within IntelliJ do Help -> Show Log in Explorer – hce Jun 15 '19 at 21:52
  • @hce if you cloned the repository I linked above, I think I expressed myself wrong. The linked repository is the library, not the actual project. – Axel Jun 15 '19 at 23:22
  • @Axel Pls. provide your actual project or a minimal sample demonstrating the issue and provide your idea.log too. – hce Jun 16 '19 at 00:07
  • @hce I've edited my question accordingly. – Axel Jun 16 '19 at 10:51

2 Answers2

4

After a lot of failed troubleshooting, I found out what the problem was. My library contained the bundled kotlin runtime, which was causing impossible to debug resolving issues with IDEA. I split up the project into multiple subprojects, where the actual api dependency does not bundle the kotlin runtime. This fixed my issues.

Axel
  • 568
  • 7
  • 18
  • I lost 2 days with the same problem and solution. I wish I saw your answer sooner! I built a JAR and bundled Kotlin in it, whilst also having Kotlin in my project already. It gave no error message but wouldn't import any dependencies. So weird – georgiecasey Feb 06 '21 at 23:06
2

I just cloned your repository from https://github.com/axelrindle/Broadcaster-Plugin

In your build.gradle file you are referencing version 1.2.2 of your PocketKnife artefact, which does not exist in your GitHub. If you use an existing version like 1.2.1 IntelliJ can resolve the dependency.

enter image description here

enter image description here

hce
  • 1,107
  • 9
  • 25
  • You are right. This is invalid, but I'm locally working with 1.3.0 already, I just didn't push the changes yet. Nevertheless thank you very much for your kind support! – Axel Jun 17 '19 at 10:05