2015-11-05 97 views
1

我即將開發一個需要Mechanical Turk java API的Scala/SBT項目。 Mturk提供瞭如何用Ant在Java中安裝依賴關係的指令。 我以爲我可以將準備好的jar(從Maven下載)放到/ lib目錄下,並且可以在我的Scala項目中工作,但編譯時會出現依賴性錯誤。這是因爲jar沒有與org.apache.commons一起打包?在Scala項目中使用JAR和SBT

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

UPDATE:

嘗試添加這種依賴於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 

回答

1

你必須在MTurk依賴添加到您的SBT構建文件(build.sbt)。像這樣:

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

仍然有問題,請檢查更新的問題。 –

+0

@marcin_koss你正在使用哪個版本的庫?這個依賴在你的maven pom.xml中如何聲明? – leshkin

+0

這是pom - https://repo1.maven.org/maven2/net/ettinsmoor/java-aws-mturk/1.6.2/java-aws-mturk-1.6.2.pom –

相關問題