SBT访问子目录 [英] SBT accessing sub directories

查看:81
本文介绍了SBT访问子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目文件结构如下:

My project file structure looks like this:


  • build.sbt

  • lib

  • 项目

  • src

  • target

  • test

  • build.sbt
  • lib
  • project
  • src
  • target
  • test

内部 lib 文件夹我有一些包含其他jar文件的子文件夹。我该如何让SBT识别子文件夹或递归地处理jar文件?

Inside lib folder I have sub folders that contain additional jar files. How can I get SBT to recognize sub-folders or to treat jar files recursively?

编辑:
感谢@Jhonny Everson我能够使它工作。方法如下:
在我的build.sbt

thanks to @Jhonny Everson I am able to get this working. Here is how: added the following line in my build.sbt

unmanagedJars in Compile <++= baseDirectory map { base =>
        val baseDirectories = (base / "lib" / "mycustomlib" )
        val customJars = (baseDirectories ** "*.jar")
        customJars.classpath
}

请注意,基本目录是build.sbt所在的位置。

Note that the base directory is where build.sbt is located.

推荐答案

如果将jar放在lib文件夹中,Sbt将自动使用它们。您可以使用 unmanagedJars 指令指定可以在其中找到jar文件的多个目录。参见 https://github.com/harrah/xsbt/wiki/图书馆管理#manual-dependence-management

if you put jars on lib folder, Sbt will use them automatically. You can use unmanagedJars directive to specify multiple directories in which jar files can be found. See https://github.com/harrah/xsbt/wiki/Library-Management#manual-dependency-management

这篇关于SBT访问子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆