Question

I have some jars installed on the system that I want to include in my SBT project's classpath. Appending to unmanagedClasspath would seem to be the way, but it balks at any value with slashes in it -- not sure why.

Currently I have the following, which successfully adds the "lib" directory under my project to the classpath:

import sbt._

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

If I try to add an absolute path in there I get the following:

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)
....

Is there a proper way to do this?

Thanks!

Was it helpful?

Solution

try super.unmanagedClasspath +++ Path.fromFile("/opt/jauimodel/lib/")

only "lib" may trigger relativePath which will trigger checkComponent method to check whether .,

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top