我正在使用 Scala 和 Slick 构建一个小型数据库查询实用程序,并使用 Maven 作为我的构建和打包工具。
我的代码编译没有任何语法错误,但构建失败:
[INFO] --- maven-scala-plugin:2.15.0:compile (default) @ origdups ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] /home/lreeder/dev/scala/origdups/src/main/scala:-1: info: compiling
[INFO] Compiling 4 source files to /home/lreeder/dev/scala/origdups/target/classes at 1375638972068
[INFO] No known dependencies. Compiling everything
[ERROR] error: bad symbolic reference. A signature in Mapper.class refers to term runtime
[INFO] in package scala.reflect which is not available.
[INFO] It may be completely missing from the current classpath, or the version on
[INFO] the classpath might be incompatible with the version used when compiling Mapper.class.
(several more similar errors)
请注意,Mapper 类不是我的代码。我认为这是 Slick 的一部分?我将 Scala 2.10.1 用于 maven-scala 插件:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.10.1</version>
</dependency>
和 Slick 2.10(目前使用 Scala 2.10.1 构建):
<dependency>
<groupId>com.typesafe.slick</groupId>
<artifactId>slick_2.10</artifactId>
<version>1.0.1</version>
</dependency>
我已经在打开 maven 调试的情况下进行了编译,这是生成上述错误的 Java 调用。
/usr/local/jdk1.7.0_21/jre/bin/java -classpath /home/lreeder/.m2/repository/org/scala-lang/scala-library/2.10.1/scala-library-2.10.1.jar :/home/lreeder/.m2/repository/org/scala-lang/scala-compiler/2.10.1/scala-compiler-2.10.1.jar:/home/lreeder/.m2/repository/org/scala-lang /scala-reflect/2.10.1/scala-reflect-2.10.1.jar:/home/lreeder/.m2/repository/org/scala-tools/maven-scala-plugin/2.15.0/maven-scala-plugin -2.15.0.jar -Xbootclasspath/a:/home/lreeder/.m2/repository/org/scala-lang/scala-library/2.10.1/scala-library-2.10.1.jar org_scala_tools_maven_executions.MainWithArgsInFile scala.tools .nsc.Main /tmp/scala-maven-6314934214401019063.args
我在这里想念什么?需要在 maven-scala 插件配置中设置什么来消除这些错误。