我尝试在scala 3代码中使用discord4j 3.2和斜杠命令。当我为斜杠命令添加代码时,sbt在编译时给了我这个错误:
[error] Bad symbolic reference. A signature
[error] refers to Value/T in package org.immutables.value which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling the signature.
[warn] Caught: java.lang.AssertionError: assertion failed: failure to resolve inner class:
[warn] externalName = org.immutables.value.Value$Immutable,
[warn] outerName = org.immutables.value.Value,
[warn] innerName = Immutable
[warn] owner.fullName = org.immutables.value.Value
[warn] while parsing ~/.cache/coursier/v1/https/oss.sonatype.org/content/repositories/snapshots/com/discord4j/discord-json/1.6.10-SNAPSHOT/discord-json-1.6.10-20210908.025209-4.jar(discord4j/discordjson/json/InteractionApplicationCommandCallbackData.class) while parsing annotations in ~/.cache/coursier/v1/https/oss.sonatype.org/content/repositories/snapshots/com/discord4j/discord-json/1.6.10-SNAPSHOT/discord-json-1.6.10-20210908.025209-4.jar(discord4j/discordjson/json/InteractionApplicationCommandCallbackData.class)
[error] Bad symbolic reference. A signature我在scala 2代码中使用相同版本的discord4j编译代码创建斜杠命令没有任何问题。
这是我的sbt文件:
val scala3Version = "3.0.2"
val scala2deps = Seq(
"com.typesafe.akka" %% "akka-actor" % "2.6.0",
"com.typesafe.akka" %% "akka-actor-typed" % "2.6.0",
"com.typesafe.akka" %% "akka-stream" % "2.6.8",
"com.typesafe.akka" %% "akka-http" % "10.2.0",
"org.scalaz" %% "scalaz-core" % "7.2.29",
"io.projectreactor" %% "reactor-scala-extensions" % "0.8.+",
"org.json4s" %% "json4s-jackson" % "3.+",
"com.lihaoyi" %% "requests" % "0.2.0",
).map(d ⇒ d.cross(CrossVersion.for3Use2_13))
lazy val root = project
.in(file("."))
.settings(
name := "PUGBot",
version := "0.1.0",
scalacOptions ++= Seq(
"-language:postfixOps",
"-language:implicitConversions",
),
scalaVersion := scala3Version,
resolvers += "d4j-snapshot" at "https://oss.sonatype.org/content/repositories/snapshots",
libraryDependencies ++= Seq(
"com.discord4j" % "discord4j-core" % "3.2.0-RC3",
) ++ scala2deps,
)如何修复此错误?
发布于 2021-10-20 12:49:22
我在de.flapdoodle.embed.mongo 3.0.0和Scala 3.0.2上也遇到了类似的问题:
scalac: Bad symbolic reference. A signature
refers to Value/T in package org.immutables.value which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling the signature.scalac: Caught: java.lang.AssertionError: assertion failed: failure to resolve inner class:
externalName = org.immutables.value.Value$Immutable,
outerName = org.immutables.value.Value,
innerName = Immutable
owner.fullName = org.immutables.value.Value
while parsing /Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/de/flapdoodle/embed/de.flapdoodle.embed.mongo/3.0.0/de.flapdoodle.embed.mongo-3.0.0.jar(de/flapdoodle/embed/mongo/config/MongodConfig.class) while parsing annotations in /Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/de/flapdoodle/embed/de.flapdoodle.embed.mongo/3.0.0/de.flapdoodle.embed.mongo-3.0.0.jar(de/flapdoodle/embed/mongo/config/MongodConfig.class)我已经添加了org.immutables.value库作为Sbt依赖,这很有帮助:
"org.immutables" % "value" % "2.8.8"https://stackoverflow.com/questions/69166256
复制相似问题