如何让 sbt 0.10.0 编译子目录中的文件?
我的项目根目录中有一个 build.sbt 文件。我的所有源文件都位于子目录 src (以及 src/irc、src/xmpp)中。
这是我的 build.sbt
名称:=“mrtoms”
组织:=“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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎您需要提供相对于基本目录的路径。这应该适合您(它替换
sourceDirectory := file("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")
):Some more information you can find in this thread:
http://groups.google.com/group/simple-build-tool/browse_thread/thread/095e87247d146fa7?fwc=1
如果你想替换默认约定,那么你需要覆盖 scala 和 java 源位置
If you want to replace the default convention then you need to override both scala and java source locations