scala – 更改sbt的输出目录
发布时间:2020-12-16 18:52:47 所属栏目:安全 来源:网络整理
导读:我想更改某些生成文件的输出目录,在本例中是从XSD-Schema生成的对象. 这是我的构建文件的一部分. val main = PlayProject(appName,appVersion,appDependencies,mainLang = SCALA,settings = Defaults.defaultSettings ++ buildInfoSettings ++ scalaxbSettin
我想更改某些生成文件的输出目录,在本例中是从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 请注意,“编译”和“测试”值基于基础“源管理”值,而后者又基于交叉目标的值,该值基于目标值和其他一些值. 您可以使用该设置轻松更改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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |