-
2.0-M1-1版本无法打包,但IDE调试运行没有问题. 使用./gradlew bootRun可以正常调试运行,去掉mirai依赖可以正常打包. ./gradlew build打包失败,日志如下:
Gradle文件: plugins {
id("org.springframework.boot") version "2.4.1"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
kotlin("jvm") version "1.4.21"
kotlin("plugin.spring") version "1.4.21"
}
dependencies {
//mirai qq bot library
implementation("net.mamoe:mirai-core:2.0-M1-1")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
developmentOnly("org.springframework.boot:spring-boot-devtools")
testImplementation("org.springframework.boot:spring-boot-starter-test")
} |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 3 replies
-
try |
Beta Was this translation helpful? Give feedback.
-
可能是 Kotlin 或 Spring 插件问题,在解决依赖时没有定义目标平台为 jvm 这个 metadata,导致冲突 |
Beta Was this translation helpful? Give feedback.
-
添加:
|
Beta Was this translation helpful? Give feedback.
-
我添加了但是没有起作用,是我添加的位置不对吗?以下是build.gradle.kts片段:
|
Beta Was this translation helpful? Give feedback.
-
尝试 #746 (comment) |
Beta Was this translation helpful? Give feedback.
-
以上方法全试了,仍然无法打包。 日志和前面的几乎一样:
|
Beta Was this translation helpful? Give feedback.
-
尝试 // build.gradle.kts
implementation("net.mamoe:mirai-core-jvm:<VER>") {
exclude("net.mamoe","mirai-core-api")
exclude("net.mamoe","mirai-core-utils")
}
implementation("net.mamoe:mirai-core-api-jvm:<VER>") {
exclude("net.mamoe", "mirai-core-utils")
}
implementation("net.mamoe:mirai-core-utils-jvm:<VER>") // build.gradle
implementation("net.mamoe:mirai-core-jvm:<VER>") {
exclude group: 'net.mamoe', module: 'mirai-core-api'
exclude group: 'net.mamoe', module: 'mirai-core-utils'
}
implementation("net.mamoe:mirai-core-api-jvm:<VER>") {
exclude group: 'net.mamoe', module: 'mirai-core-utils'
}
implementation("net.mamoe:mirai-core-utils-jvm:<VER>") |
Beta Was this translation helpful? Give feedback.
-
这样成功解决了😊 |
Beta Was this translation helpful? Give feedback.
-
implementation("net.mamoe:mirai-core-jvm:2.10.1") { 依旧报错:
|
Beta Was this translation helpful? Give feedback.
-
感谢给我提供了思路,我自己指定了平台成功解决了
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
testImplementation("org.springframework.boot:spring-boot-starter-test")
compileOnly("org.springframework.boot:spring-boot-configuration-processor")
// 使用mirai提供的pom,方便进行版本管理
api(platform("net.mamoe:mirai-bom:2.9.1"))
//这里添加-jvm后缀
api("net.mamoe:mirai-core-api-jvm") // 编译代码使用
runtimeOnly("net.mamoe:mirai-core-jvm") // 运行时使用
implementation("com.google.code.gson:gson")
implementation("cn.hutool:hutool-http:5.8.3")
} |
Beta Was this translation helpful? Give feedback.
-
使用目前最新版2.15.0-M1遇到了类似问题
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.21'
}
dependencies {
// mirai
api(platform("net.mamoe:mirai-bom:2.15.0-M1"))
api("net.mamoe:mirai-core-api-jvm") // 编译代码使用
runtimeOnly("net.mamoe:mirai-core-jvm") // 运行时使用
}
|
Beta Was this translation helpful? Give feedback.
尝试