Add an extra lib folder dependency to build sbt in a lift project

China☆狼群 提交于 2019-12-23 09:31:27

问题


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")

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")

Any pointers greatly appreciated

Regards

Des


回答1:


You can use sbt's Path API to get all jars in your directory.

Edit: a shorter version using .classpath:

unmanagedJars in Compile ++= 
  (file("[Path to My Project]/lib/") * "*.jar").classpath

which is more or less equivalent to:

unmanagedJars in Compile ++= 
  Attributed.blankSeq((file("[Path to My Project]/lib/") * "*.jar").get)

(Attributed is necessary because unmanagedJars is a setting of type Seq[Attributed[File]] and not Seq[File])



来源:https://stackoverflow.com/questions/16940120/add-an-extra-lib-folder-dependency-to-build-sbt-in-a-lift-project

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!