1

我想使用Scala 3并使用一些现有的库。该示例适用于 Scala 2.13。

编译时出现此异常:

dotc: Bad symbolic reference. A signature in ../dmn-engine-1.4.0.jar(org/camunda/dmn/parser/ParsedDmn.class)
refers to Serializable/T in package scala 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 ../dmn-engine-1.4.0.jar(org/camunda/dmn/parser/ParsedDmn.class).

这是我的build.sbt

lazy val extension = project
  .in(file("extension"))
  .settings(scalaVersion := dottyVersion,
    libraryDependencies ++= Seq(
      ("org.camunda.bpm.extension.dmn.scala" % "dmn-engine" % "1.4.0").withDottyCompat(scalaVersion.value),
      "com.novocode" % "junit-interface" % "0.11" % "test",
      "org.scalatest" %% "scalatest" % "3.2.2" % Test
    ),

    scalacOptions ++= {
      if (isDotty.value) Seq("-source:3.0-migration") else Nil
    }
  )

更新 好的,它适用于2.12,使用2.13我收到以下错误:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Serializable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    ...
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
    Caused by: java.lang.ClassNotFoundException: scala.Serializable
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
        ... 19 more
4

1 回答 1

3

弄清楚它只适用于 Scala 2.12,我发现了问题。

libraryDependencies"org.camunda.bpm.extension.dmn.scala" % "dmn-engine" % "1.4.0"指的是 Scala 2.12。

于 2020-09-20T07:33:44.820 回答