[英]Change output directory of sbt
我想更改某些生成文件的输出目录,在本例中是从XSD-Schema生成的对象。
这是我的构建文件的一部分。
val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA,
settings = Defaults.defaultSettings ++ buildInfoSettings ++ scalaxbSettings
).settings(
sourceGenerators in Compile <+= buildInfo,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "hello",
packageName in scalaxb in Compile := "models",
sourceGenerators in Compile <+= scalaxb in Compile
)
此代码将生成的文件放入以下目录:
target/scala-2.10/src_managed/main/models/
如何更改构建文件以将文件输出到下面呢?
/app/models/
查看sourceManaged
设置密钥。 任何源生成器任务通常都会将东西放入该设置指定的文件中。
source-managed - target/scala-2.10/src_managed
compile:source-managed - target/scala-2.10/src_managed/main
test:source-managed - target/scala-2.10/src_managed/test
请注意,“编译”和“测试”值基于基础“源管理”值,而后者又基于cross-target
的值,该值基于target
和其他一些值。
您可以使用该设置轻松更改sbt构建定义中的compile:source-managed
设置的值
sourceManaged in Compile := file("app/models")
如果你想让你的设置基于另一个设置,比如项目的基本目录,你可以使用更像的东西
sourceManaged in Compile <<= baseDirectory { _ / "app/models" }
当然,您可以在此处找到有关使用设置的大量信息:
http
:
//www.scala-sbt.org/release/docs/Getting-Started/More-About-Settings
编辑:看起来那个链接已经死了。 已经有几年了,所以我不是百分百肯定,但这可能接近原始链接所说的内容: SBT 0.13 - 构建定义或SBT 1.0 - 构建定义
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.