【发布时间】:2019-10-29 19:26:28
【问题描述】:
我目前正在使用 Gradle (source code here) 进行 Kotlin 项目。这是一个 Bukkit 插件,它依赖于我维护的一个库 (library source code here)。在终端中运行 ./gradlew assemble 时,一切正常并且构建成功(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
但是在 IDEA 中工作时,我的库是唯一一个 IDE 出于某种原因无法解析的库。
我已经尝试了以下步骤:
- 删除 gradle/idea 缓存 (
~/.gradle/caches;.idea) - 重新安装 IDEA
- 删除 IDEA 配置目录 (
.IdeaIC2019.1) - 在 IDEA 中重新导入项目
我已经阅读了以下问题/答案,但没有一个有效:
- Getting Gradle dependencies in IntelliJ IDEA using Gradle build
- Unable to resolve dependencies in IntelliJ IDEA 2018.1
- Gradle dependencies not working in IntelliJ
- IntelliJ won't recognize some imports from gradle project
- Intellij: Gradle dependency not found
另外,我的idea.log 可以在这里找到:https://pastebin.com/0Z5b3Wdp
最后但并非最不重要的一些版本信息:
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
【问题讨论】:
-
@Anatolii 正如我所提到的,我已经尝试删除整个
.idea目录并在之后重新导入。没用。 -
@Axel 我刚刚克隆了您的存储库并在 IntelliJ 中成功执行了 build->assemble。您可以尝试将您的存储库克隆到另一个目录并再试一次吗?
-
@Axel 你也可以提供你的idea.log吗?在 IntelliJ 中执行帮助 -> 在资源管理器中显示日志
-
@hce 如果你克隆了我上面链接的存储库,我想我表达自己错了。链接的存储库是库,而不是实际项目。
-
@Axel 请。提供您的实际项目或演示问题的最小示例,并提供您的idea.log。
标签: gradle intellij-idea kotlin bukkit