如何让 sbt 0.10.0 编译子目录中的文件?

发布于 2024-11-15 17:54:32 字数 606 浏览 2 评论 0原文

我的项目根目录中有一个 build.sbt 文件。我的所有源文件都位于子目录 src (以及 src/irc、src/xmpp)中。

这是我的 build.sbt

名称:=“mrto​​ms”

组织:=“chilon”

scala版本:=“2.9.0”

版本:=“0.1”

libraryDependency ++= Seq("commons-httpclient" % "commons-httpclient" % "3.1")

交叉路径:= false

scalaHome := Some(file("/usr/share/scala"))

目标:=文件(“项目/目标”)

源目录:=文件(“src”)

mainClass := Some("org.chilon.mrtoms.MrToms")

但是 sbt 总是只创建一个空的 jar 文件。

我尝试将 build.sbt 放入“src”目录中,但随后它错过了“src”子目录中的所有 scala 文件。

I have a build.sbt file in my project root.. all my source files live in the subdirectory src (and src/irc, src/xmpp).

Here is my build.sbt

name := "mrtoms"

organization := "chilon"

scalaVersion := "2.9.0"

version := "0.1"

libraryDependencies ++= Seq("commons-httpclient" % "commons-httpclient" % "3.1")

crossPaths := false

scalaHome := Some(file("/usr/share/scala"))

target := file("project/target")

sourceDirectory := file("src")

mainClass := Some("org.chilon.mrtoms.MrToms")

However sbt always just makes an empty jar file.

I tried putting build.sbt inside the "src" directory but then it missed out all the scala files in subdirectories of "src".

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

碍人泪离人颜 2024-11-22 17:54:32

似乎您需要提供相对于基本目录的路径。这应该适合您(它替换 sourceDirectory := file("src")):

scalaSource in Compile <<= baseDirectory(_ / "src")

您可以在此线程中找到更多信息:

http://groups.google.com/group/simple-build-tool/browse_thread/thread/095e87247d146fa7?fwc=1

Seems that you need to provide path relative to the base directory. This should work for you (it replaces sourceDirectory := file("src")):

scalaSource in Compile <<= baseDirectory(_ / "src")

Some more information you can find in this thread:

http://groups.google.com/group/simple-build-tool/browse_thread/thread/095e87247d146fa7?fwc=1

夜雨飘雪 2024-11-22 17:54:32

如果你想替换默认约定,那么你需要覆盖 scala 和 java 源位置

scalaSource in Compile <<= baseDirectory(_ / "src")

javaSource in Compile <<= baseDirectory(_ / "src")

If you want to replace the default convention then you need to override both scala and java source locations

scalaSource in Compile <<= baseDirectory(_ / "src")

javaSource in Compile <<= baseDirectory(_ / "src")
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文