On Sun, Jul 8, 2012 at 1:35 AM, Feng Zhou <
fe...@zhou.es> wrote:
> I'd like to use a jar file in my scala sbt project. The sbt documentation on
> library managements sounds like it's simple to do so: just put the jars into
> the lib directory; but it didn't work for me.
>
> I assumed the lib directory it refers to is a directory named "lib" under
> the base directory, as in my_project/lib, is this correct? If not, can you
> please let me know where to put the jars and whether I need to modify any
> sbt definition to use jars?
"Just put the jars into the lib directory" should work. Demonstration
transcript:
% mkdir foo
% cd foo
% mkdir -p src/main/scala
% cat > src/main/scala/S.scala
object S {
import org.junit.Assert._
}
% sbt compile
[info] Set current project to default-285204 (in build file:/Users/tisue/foo/)
[info] Updating {file:/Users/tisue/foo/}default-285204...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to
/Users/tisue/foo/target/scala-2.9.1/classes...
[error] /Users/tisue/foo/src/main/scala/S.scala:2: object junit is not
a member of package org
[error] import org.junit.Assert._
[error] ^
[error] one error found
[error] {file:/Users/tisue/foo/}default-285204/compile:compile:
Compilation failed
[error] Total time: 2 s, completed Jul 8, 2012 10:02:16 AM
% mkdir lib
% curl -O '
http://repo1.maven.org/maven2/junit/junit/4.10/junit-4.10.jar'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 247k 100 247k 0 0 91257 0 0:00:02 0:00:02 --:--:-- 106k
% mv junit-4.10.jar lib
% sbt compile
[info] Set current project to default-285204 (in build file:/Users/tisue/foo/)
[info] Compiling 1 Scala source to
/Users/tisue/foo/target/scala-2.9.1/classes...
[success] Total time: 2 s, completed Jul 8, 2012 10:03:45 AM
%
--
Seth Tisue | Northwestern University |
http://tisue.net
lead developer, NetLogo:
http://ccl.northwestern.edu/netlogo/