从kotlin 1.4.30开始,kotlin编译器-可嵌入依赖项在其主jar包中包含了用于“embeddable”库的文件。这个问题与我的pom.xml文件中的本地指定的fastutil版本相冲突。
是否有任何方法可以包括1.4.30Kotlin编译器可嵌入的依赖项,而忽略/ it /unimi/dsi/快捷文件夹,这样它就只能使用我指定的版本了吗?
kotlin编译器的屏幕截图-可嵌入布局:
项目在这里:https://gofile.io/d/9m5LiV
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap // Default imports from the kotlin-compiler-embeddable lib
fun main(args: Array<String>) {
// http://fastutil.di.unimi.it/docs/it/unimi/dsi/fastutil/ints/Int2ObjectOpenHashMap.html#%3Cinit%3E(int)
// ^ this is possible when you dont have a kotlin-compiler-embeddable conflict
// Because its importing this class from the kotlin-compiler-embeddable library
// instead of the fastutil library itself
val map = Int2ObjectOpenHashMap<String>(10)
println("Hello World!")
}
发布于 2021-02-07 21:32:49
Maven 2.0.9早在2008年就引入了类路径上依赖项的确定性排序。
如果您有两个包含相同类的依赖项,则pom中提到的第一个类将获胜。
您可以使用mvn dependency:build-classpath
检查类路径。
在您的例子中,在kotlin编译器之前放置fastutil。
<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>8.2.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler-embeddable</artifactId>
<version>1.4.30</version>
</dependency>
备注:
kotlin-compiler
是否也使用了,所以使用它而不是kotlin-compiler-embeddable
不会有帮助。https://stackoverflow.com/questions/66092841
复制相似问题