如何解决sbt中的非jar(dll/jnilib)库依赖关系?

Mar*_*ela 4 scala sbt

在SBT build.sbt项目文件中,是否可以检索未捆绑为的库依赖项jar

就我而言,我正在尝试使用需要和库的QTSampledSP..dll.jnilib

jsu*_*eth 7

要下载工件,您需要让Ivy(以及因此sbt)明确地知道DLL工件.build.sbt在项目中添加以下内容.

lazy val QtSampledJniLibArt = Artifact("qtsampledsp-osx", "jnilib", "jnilib")

libraryDependencies += "com.tagtraum" % "qtsampledsp-osx" % "0.9.6" artifacts(QtSampledJniLibArt)

resolvers += "beatunes" at "http://www.beatunes.com/repo/maven2"
Run Code Online (Sandbox Code Playgroud)

然后你需要告诉sbt注意这些工件(再次build.sbt):

classpathTypes ++= Set("jnilib", "dll")
Run Code Online (Sandbox Code Playgroud)

默认情况下,SBT只会增加几个类型到类路径(与jnilibdll没有在他们之中).

[sbt-0-13-1]> help classpathTypes
Artifact types that are included on the classpath.
[sbt-0-13-1]> show classpathTypes
[info] Set(eclipse-plugin, bundle, hk2-jar, orbit, jar)
Run Code Online (Sandbox Code Playgroud)

由于类路径上需要这些DLL/jnilib才能正确运行,所以classpathTypes添加其他类型的上述设置将更正如下所示的内容(不要忘记reload在sbt控制台中).

[sbt-0-13-1]> show classpathTypes
[info] Set(eclipse-plugin, bundle, hk2-jar, jnilib, orbit, jar, dll)
Run Code Online (Sandbox Code Playgroud)

如果您需要查看这些文件的更多详细信息,请查看更新报告(来自update任务),您可以在其中检查所有配置/模块/工件.show update在sbt控制台中运行并查看中的文件target/resolution-cache/reports.