添加一个额外的lib文件夹依赖关系以在Lift项目中构建sbt [英] Add an extra lib folder dependency to build sbt in a lift project
问题描述
我有一个我的Lift项目依赖的外部Java项目.通过将以下行添加到我的sbt中,我已经能够将依赖项添加到该项目中的类:
I have an external java project that my lift project depends on. I have been able to add the dependency to the classes in that project by adding the following line to my sbt:
unmanagedClasspath in Compile += file("[Path to My Project]/classes")
但是该项目还有一个lib文件夹,它引用了一组jar,因此我无法弄清楚添加这些依赖项的正确语法是什么.尝试了以下方法,但不起作用:
But this project also has a lib folder with a set of jars that it references and I cannot figure out what the correct syntax should be to add these dependencies. Have tried the following but it does not work:
unmanagedJars in Compile += file("[Path to My Project]/lib/*.jar")
任何指针都非常感谢
致谢
Des
推荐答案
您可以使用sbt的 Path API 即可获取目录中的所有jar.
You can use sbt's Path API to get all jars in your directory.
编辑:使用.classpath
的较短版本:
unmanagedJars in Compile ++=
(file("[Path to My Project]/lib/") * "*.jar").classpath
或多或少等于:
unmanagedJars in Compile ++=
Attributed.blankSeq((file("[Path to My Project]/lib/") * "*.jar").get)
(Attributed
是必需的,因为unmanagedJars
是类型Seq[Attributed[File]]
而不是Seq[File]
的设置)
(Attributed
is necessary because unmanagedJars
is a setting of type Seq[Attributed[File]]
and not Seq[File]
)
这篇关于添加一个额外的lib文件夹依赖关系以在Lift项目中构建sbt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!