marcin_koss
marcin_koss

Reputation: 5882

Using jars in Scala project with SBT

I'm about to work on a Scala/SBT project that requires Mechanical Turk java API. Mturk provides instruction how to install dependency in Java with Ant. I thought I could just drop ready jar (downloaded from Maven) into the /lib and that should work in my Scala project but I get dependency errors when compiling. Is this because jar is not packaged with org.apache.commons?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/protocol/SecureProtocolSocketFactory

UPDATE:

Tried adding this dependency to SBT.

libraryDependencies += "net.ettinsmoor" % "java-aws-mturk" % "1.6.2"

Error:Error while importing SBT project:
...
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:235)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
[error] sbt.ResolveException: unresolved dependency: org.apache.commons#not-yet-commons-ssl;0.3.7: not found
[error] unresolved dependency: apache-xerces#xercesImpl;2.9.1: not found
[error] unresolved dependency: apache-xerces#resolver;2.9.1: not found
[error] unresolved dependency: apache-xerces#xml-apis;2.9.1: not found
[error] Use 'last' for the full log.

See complete log in /Users/marcin/Library/Logs/IdeaIC14/sbt.last.log

Upvotes: 1

Views: 215

Answers (1)

codejitsu
codejitsu

Reputation: 3182

You have to add the MTurk dependency to your sbt build file (build.sbt). Like that:

libraryDependencies += "org.clojars.zaxtax" % "java-aws-mturk" % "1.6.2"

Upvotes: 1

Related Questions