I want to change my output directory for some generated files, in this case generated objects from an XSD-Schema.
Here is part of my Build file.
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
)
This code puts my generated files into the below directory:
target/scala-2.10/src_managed/main/models/
How can I change my buildfile to output the files to below instead?
/app/models/
Check out the
sourceManaged
setting key. Any source generator tasks will generally put stuff in the file specified by that setting.Note that the "compile" and "test" values base themselves off of the base "source-managed" value, which is in turn based on the value of
cross-target
, which is based on the value oftarget
and a few others.You can easily change the value of the
compile:source-managed
setting in an sbt build definition with the settingIf you want to base your setting off of another setting, like the project's base directory, you could use something more like
Of course, you can find plenty of info on using settings here:
http://www.scala-sbt.org/release/docs/Getting-Started/More-About-Settingsedit: Looks like that link is dead. It's been a few years so I'm not 100% sure, but this is probably close to what the original link talked about: SBT 0.13 - Build definition or SBT 1.0 - Build definition