【问题标题】:Bad symbolic reference with discord4jdiscord4j 的错误符号引用
【发布时间】:2021-11-08 22:58:33
【问题描述】:

我正在尝试在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

使用相同版本的discord4j 但在scala 2 代码中编译创建斜线命令的代码没有问题。

这是我的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,

  )

我该如何解决这个错误?

【问题讨论】:

  • 这类错误通常表明您正在尝试使用旧版本的 sbt 编译 Scala 3。确保您使用的是最新版本。

标签: java scala-3 discord4j


【解决方案1】:

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"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-21
    • 2013-10-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多