我已将此添加到我的build.sbt:
resourceGenerators in Compile <+=
(resourceManaged in Compile, name, version) map { (dir, n, v) =>
val file = dir / "version"
val contents = Process("git rev-parse HEAD").lines.head
IO.write(file, contents)
println("I have just been run")
Seq(file)
}
但是当我发出sbt run
时它会运行,而不是在发出sbt compile
时运行。
如何在compile
上运行它?除了禁用插件之外,我该如何排除故障? (禁用可疑插件并没有解决......)
sbt版本和插件:
[info] This is sbt 0.13.5
[info] The current project is built against Scala 2.11.2
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, play.twirl.sbt.SbtTwirl, com.scalapenos.sbt.prompt.SbtPrompt, com.typesafe.sbteclipse.plugin.EclipsePlugin, com.typesafe.sbt.SbtStartScript, spray.revolver.RevolverPlugin, org.netbeans.nbsbt.plugin.NetBeansPlugin, com.typesafe.sbt.SbtScalariform, sbtbuildinfo.Plugin, com.typesafe.sbt.SbtGit
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4