Scala 更改sbt的输出目录
我想更改一些生成文件的输出目录,在本例中是从XSD模式生成的对象 这是我构建文件的一部分Scala 更改sbt的输出目录,scala,playframework,sbt,playframework-2.1,scalaxb,Scala,Playframework,Sbt,Playframework 2.1,Scalaxb,我想更改一些生成文件的输出目录,在本例中是从XSD模式生成的对象 这是我构建文件的一部分 val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA, settings = Defaults.defaultSettings ++ buildInfoSettings ++ scalaxbSettings ).settings( sourceGenerators in Co
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
)
如何更改构建文件以将文件输出到下面
/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
请注意,“编译”和“测试”值以基本的“源代码管理”值为基础,后者依次基于跨目标
的值,后者基于目标
的值和其他一些值
在sbt生成定义中,您可以使用该设置轻松更改compile:source-managed
设置的值
sourceManaged in Compile := file("app/models")
如果您想以另一个设置(如项目的基本目录)作为设置的基础,可以使用
sourceManaged in Compile <<= baseDirectory { _ / "app/models" }
sourceManaged in Compile如果a想更改可能由eBean生成的SourceGenerator,该怎么办?看起来链接现在已经旧了:/@WillBeason我已经用一个新链接编辑了我的答案,希望它能涵盖相同的内容。@WillBeason这是一个存档版本:
sourceManaged in Compile <<= baseDirectory { _ / "app/models" }