

IDEA gradle-kotlin 项目,引入自己写的 jar 包, IDEA 无法正常 import,报 Unresolv...
source link: https://www.v2ex.com/t/779367
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

IDEA gradle-kotlin 项目,引入自己写的 jar 包, IDEA 无法正常 import,报 Unresolved reference,但是实际上是生效的…
heavyrainn · 1 天前 · 389 次点击已经尝试过 invalidate caches,但是没啥帮助…请问各位有啥好的解决方法么…谢谢大家…
fdppzrl 1 天前
api:该依赖方式会传递所依赖的库,当其他 module 依赖了该 module 时,可以使用该 module 下使用 api 依赖的库。
zerofancy 18 小时 50 分钟前 via Android
wjploop 16 小时 7 分钟前
在 IDEA 的 Gradle 项目中,编译运行加载 Class 和 IDEA 索引 Class 是两套不同的东西,故存在可以编译通过而 IDEA 爆红提示没法索引到正确 Class 的情况。
如何理解证实这一点? IDEA 构建非 Gradle 项目,仍可以正确索引 Class,其代码组织结构信息放在*.iml 文件中,而在 Gradle 项目中,我们接触修改的一般是.gradle 文件,依赖信息也放在.gradle 文件中,但当 IDEA 索引相关的类时,还是需要将相关信息转化成.iml 文件来让 IDEA 获知。关于 Gradle,它扮演了一个组织配置文件信息与 IDE 无关的角色,这样 Gradle 项目可以容易导入到其他 IDE,如 Eclipse 或 VsCode 。
回到本问题,思路上应该是*.iml 未能正确生成的结果。我这边的情况是,引入了与系统类重复的 jar 包,编译运行解决的使用了-Xbootclasspath/p:xxx.jar 来告知 jvm 优先加载我的类,但这个告知信息却不能同步到*.iml 文件中,故能编译却爆红;解决方案是,自己手动去修改其中.iml 文件中 OrderEntry,OrderEntry 用来管理依赖检索顺序,将系统类的 OrderEntry 放到后面得以解决。
(居然 bb 这么多~)
Recommend
-
219
Simon Wirtz Blog - Taking a look at the Gradle Kotlin DSL as an alternative to classic Groovy approach: Better support from IDE, one language for everything
-
205
kotlin-dsl-jooq-plugin A plugin that closely mirrors the de-facto (but non-official) gradle plugin for jOOQ by etiennestuder. While the gradle plu...
-
179
Before I dive into the code some goods things first:Kotlin DSL is directly bundled in gradle. You don’t need an extra buildscript or something to use it.It is possible to use the same configuratio...
-
118
-
115
This is a guest blog post from Eric Wendelin software engineer for Gradle A build cache allows Gradle to reuse task output from any previous invocation, including those from other machines. Kotlin …
-
100
The Kotlin DSL for writing Gradle build scripts have been around for some time. In this article we'll take a look at it and see how useful it is.
-
74
The talk Type-safe build logic with Gradle Kotlin-DSL in particular gave me the inspiration to write about a subject I have been playing with great delight recently, and even launch an IMHO neat…
-
53
在 Gradle 5.0 之後就可以開始支援在 *.gradle 檔案裡面使用 Kotlin DSL,這篇文章將會講解如何把 Android 專案的 Gradle build script 轉換為使用 Kotlin DSL,讓你可以直接無痛使用 Kotlin 撰寫 *.gradle,而捨棄(超難用)的 Groovy 語...
-
8
未分类 Kotlin项目引入AspectJ遇到java.util.zip.ZipException: zip file is empty的解决方法 在gradle中加入对kotlin的忽略即可,代码如下
-
9
V2EX › 程序员 请教, kotlin 升级到 1.5.0 之后无法 gradle build 了,会报 Could not find method compile() XXXX 错误
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK