2010-11-17 68 views
2

我在我的SBT項目的類路徑中包含的系統上安裝了一些jars。追加到非託管類路徑似乎是這樣,但它在任何價值與斜線在它 - 不知道爲什麼。在SBT項目中包含任意類路徑條目

目前我有以下的,其成功添加「lib」目錄我的項目下的類路徑:

import sbt._ 

class OvationImporterProject(info: ProjectInfo) extends DefaultProject(info) 
{ 
    override def unmanagedClasspath: PathFinder = 
    { 
    super.unmanagedClasspath +++ "lib" 
    } 
} 

如果我試圖在那裏我碰到下面添加一個絕對路徑:

 

java.lang.IllegalArgumentException: requirement failed: Path component '/opt/jauimodel/lib/' must not have forward slashes in it 
    at scala.Predef$.require(Predef.scala:112) 
    at sbt.Path$.checkComponent(Path.scala:176) 
    at sbt.RelativePath.(Path.scala:113) 
    at sbt.Path.$div(Path.scala:34) 
    at sbt.Project$class.path(Project.scala:143) 
    at sbt.BasicScalaProject.path(DefaultProject.scala:21) 
    at OvationImporterProject.unmanagedClasspath(OvationImporter.scala:7) 
.... 

有沒有適當的方法來做到這一點?

謝謝!

回答

3

嘗試 super.unmanagedClasspath +++ Path.fromFile( 「/選擇/ jauimodel/LIB /」)

僅 「LIB」 可以觸發relativePath將觸發checkComponent方法來檢查是否,

+0

謝謝,那就是訣竅。 =) – spieden 2010-11-19 22:06:11