有没有办法在sbt中设置注释处理器输出路径?
目前,它将文件生成为:
target/scala-2.11/classes
不过,我更希望
target/scala-2.11/src_managed
发布于 2016-04-09 17:38:56
有点像
// in build.sbt:
// create managed source directory before compile
compile in Compile <<= (compile in Compile) dependsOn Def.task { (managedSourceDirectories in Compile).value.head.mkdirs() },
// tell the java compiler to output generated source files to the managed source directory
javacOptions in Compile ++= Seq("-s", (managedSourceDirectories in Compile).value.head.getAbsolutePath),发布于 2020-11-24 11:11:02
配置sourceManaged而不是managedSourceDirectories稍微更符合人体工程学。
在build.sbt中添加到sbt模块的设置
Compile / javacOptions ++= Seq("-s", (Compile / sourceManaged).value.getAbsolutePath)您也可以将这个插件放到project文件夹中。
package custom.sbt
import sbt.{Def, _}
import sbt.Keys._
object Compiler extends AutoPlugin {
override def trigger = allRequirements
override def buildSettings: Seq[Def.Setting[_]] = Seq(
Compile / javacOptions ++= Seq("-source", "11", "-target", "11"),
scalacOptions ++= Seq(
"-target:11" // Target JRE 11
)
)
override def projectSettings: Seq[Def.Setting[_]] = Seq(
Compile / javacOptions ++= Seq("-s", (Compile / sourceManaged).value.getAbsolutePath)
)
}发布于 2020-04-14 00:51:07
在sbt 0.13.15中
compile := ((compile in Compile) dependsOn Def.task {
(sourceManaged in Compile).value.mkdirs()
}).value,
javacOptions in Compile ++= Seq("-s", s"${sourceManaged.value}/main")https://stackoverflow.com/questions/36407543
复制相似问题