我正在尝试建立一个旧项目。
该项目取决于在sparrow-1.0.jar
我将jar复制到了lib_managed/jars
和lib
目录中,但是在编译时我仍然遇到缺少的类路径错误。
project/SparkBuild.sbt
包含对lib
目录的引用
unmanagedJars in Compile <<= baseDirectory map { base => (base / "lib" ** "*.jar").classpath },
和./lib
root@26eefef538b1:/sparrow/spark-sparrow# tree -D lib
lib
|-- jars
| `-- sparrow-1.0-SNAPSHOT.jar
|-- sparrow-1.0-SNAPSHOT.jar
`-- sparrow.jar
但是,当我编译时,我仍然遇到相同的错误:
root@26eefef538b1:/sparrow/spark-sparrow# sbt/sbt package assembly
[info] Loading project definition from /sparrow/spark-sparrow/project/project
[info] Loading project definition from /sparrow/spark-sparrow/project
[info] Set current project to root (in build file:/sparrow/spark-sparrow/)
[info] Compiling 260 Scala sources and 16 Java sources to /sparrow/spark-sparrow/core/target/scala-2.9.3/classes...
[error] /sparrow/spark-sparrow/core/src/main/scala/spark/scheduler/sparrow/SparrowScheduler.scala:28: not found: object edu
[error] import edu.berkeley.sparrow.thrift.FrontendService
[error] ^
从jar导入add classpath到项目中是否缺少命令行选项或其他配置?
使用scala 2.9.3
针对sbt 0.12.3
编译项目
我注意到我可以在类路径上使用jar运行scala并导入对象。
root@26eefef538b1:/sparrow/spark-sparrow# scala -cp $SPARROW_JAR
Welcome to Scala version 2.9.3 (OpenJDK 64-Bit Server VM, Java 1.7.0_201).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import edu.berkeley.sparrow.thrift.FrontendService
import edu.berkeley.sparrow.thrift.FrontendService
scala>
答案 0 :(得分:0)
将lib目录和jar添加到子目录。
例如./core/lib/sparrow.jar
似乎已经解决了问题