好吧,我需要将用eclipse制作的项目转换为SBT项目。 仍然,当我编译时,一些未解决的依赖项会导致编译错误。
> compile
[info] Compiling 9 Scala sources to /home/giladhoch/workspace/clever_dropbox/clever_dropbox_manager/target/scala-2.9.0.1/classes...
[error] /home/giladhoch/workspace/clever_dropbox/clever_dropbox_manager/src/main/scala/filesTagSystem/DynamicClassLoader.scala:7: not found: object labels
[error] import labels.FileLabeler
[error] ^
[error] /home/giladhoch/workspace/clever_dropbox/clever_dropbox_manager/src/main/scala/filesTagSystem/DynamicClassLoader.scala:96: value labelFile is not a member of type parameter A
[error] fileLabelers.foreach{ f=> f.labelFile(file).foreach{ s=> tagsList+=s}}
[error] ^
[error] /home/giladhoch/workspace/clever_dropbox/clever_dropbox_manager/src/main/scala/watchDirectory/ServiceManager.scala:9: object StandardWatchEventKind is not a member of package java.nio.file
[error] import java.nio.file.StandardWatchEventKind._
[error] ^
[error] /home/giladhoch/workspace/clever_dropbox/clever_dropbox_manager/src/main/scala/main/clientManager.scala:24: overloaded method constructor Thread with alternatives:
[error] (java.lang.String)java.lang.Thread <and>
[error] (java.lang.Runnable)java.lang.Thread
[error] cannot be applied to (watchDirectory.ServiceManager)
[error] val serviceThread = new Thread(service)
[error] ^
[error] four errors found
[error] {file:/home/giladhoch/workspace/clever_dropbox/clever_dropbox_manager/}default-55f3d0/compile: Compilation failed
[error] Total time: 3 s, completed Sep 15, 2011 4:42:32 AM
如您所见,错误是由两个未解决的导入引起的。
第一个用于import labels.FileLabeler
,第二个用于import java.nio.file.StandardWatchEventKind._
好吧,我不知道为什么java.nio导入不起作用。 JAVA_HOME被定义为java7文件夹,所以不应该SBT知道要看那里吗?而对于其他导入,它是一个本地预编译的类文件。我试图在build.sbt
添加以下内容:
resolvers += Resolver.file("local-lib", file("/home/*path-to-project*/src/main/scala/tagsPluginsDir/")) transactional()
但它没有多大帮助...... 那怎么能解决呢?
感谢, 吉拉德。
答案 0 :(得分:1)
问题已解决: 对于外部源文件,我打开了一个新的sbt项目并使用了publish-local,因此jar终止于.ivy2文件夹,所以sbt现在知道从哪里获取依赖项。
对于java.nio.file.StandardWatchEventKind导入,原来它只是缺少尾随s,它应该是:java.nio.file.StandardWatchEventKind * s *