Unsolved gradle引入依赖错误
-
在执行fabric:build的时候出现了报错
Could not determine the dependencies of task ':fabric:shadowJar'. > Could not resolve all dependencies for configuration ':fabric:shadow'. > Could not resolve net.mamoe:mirai-core:2.15.0-M1. Required by: project :fabric > project :common > Cannot choose between the following variants of net.mamoe:mirai-core:2.15.0-M1: - androidRuntimeElements-published - jvmRuntimeElements-published All of them match the consumer attributes: - Variant 'androidRuntimeElements-published' capability net.mamoe:mirai-core:2.15.0-M1: - Unmatched attributes: - Provides org.gradle.category 'library' but the consumer didn't ask for it - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it - Provides org.gradle.status 'release' but the consumer didn't ask for it - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it - Provides org.jetbrains.kotlin.platform.type 'androidJvm' but the consumer didn't ask for it - Variant 'jvmRuntimeElements-published' capability net.mamoe:mirai-core:2.15.0-M1: - Unmatched attributes: - Provides org.gradle.category 'library' but the consumer didn't ask for it - Provides org.gradle.libraryelements 'jar' but the consumer didn't ask for it - Provides org.gradle.status 'release' but the consumer didn't ask for it - Provides org.gradle.usage 'java-runtime' but the consumer didn't ask for it - Provides org.jetbrains.kotlin.platform.type 'jvm' but the consumer didn't ask for it
几个关键文件
-
-
https://github.com/mamoe/mirai/issues/2402#issuecomment-1368473584
将
org.jetbrains.kotlin.platform.type
定义为jvm
即可 -
@Karlatemp 在 gradle引入依赖错误 中说:
https://github.com/mamoe/mirai/issues/2402#issuecomment-1368473584
将
org.jetbrains.kotlin.platform.type
定义为jvm
即可我不会改....又出现新的错误了
Cannot have two attributes with the same name but different types. This container already has an attribute named 'org.jetbrains.kotlin.platform.type' of type 'org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType' and you are trying to store another one of type 'java.lang.String'
我在
common/build.gradle
文件新增了几行configurations.all { attributes { attribute(Attribute.of("org.jetbrains.kotlin.platform.type", String.class), "jvm") } }
然后
common/build.gradle
就变成这样plugins { id 'org.jetbrains.kotlin.jvm' version '1.8.21' } dependencies { implementation "org.xerial:sqlite-jdbc:3.41.2.1" implementation 'com.alibaba.fastjson2:fastjson2:2.0.29' implementation 'org.yaml:snakeyaml:2.0' // chatgpt implementation 'com.github.plexpt:chatgpt:4.0.7' // mirai implementation 'net.mamoe:mirai-core:2.15.0-M1' implementation "net.kyori:adventure-api:4.13.1" } configurations.all { attributes { attribute(Attribute.of("org.jetbrains.kotlin.platform.type", String.class), "jvm") } }
我看一个人在其中一个pull说的可能有用?但不知道要怎么做 Link
大佬能详细点吗
或者说我修改的文件错了?