我正在使用sbt-xjc插件来生成我的 xml 类。
的默认值以 .sourceManaged
开头xjc
。我想删除xjc
. 我该怎么做?
有了这个配置build.sbt
,XJC 直接在src_managed/main
.
SbtXjcPlugin.xjcSettings ++ Seq(
sources in (Compile, xjc) <<= baseDirectory map (_ / "xsd" ** "*.xsd" get),
sourceManaged in (Compile, xjc) <<= sourceManaged / "main"
)
XJC 将在其中查找 xsd 文件/xsd
并将生成的类输出到/target/scala-2.x/src_managed/main
对我来说,将以下内容添加到 project/build.scala 工作:
++ Seq(
sourceManaged in (Compile, SbtXjcPlugin.xjc) <<= sourceManaged
整个文件如下所示:
import com.github.retronym.sbtxjc.test.BaseScriptedTestBuild
import com.github.retronym.sbtxjc.SbtXjcPlugin
import sbt._
import Keys._
object build extends BaseScriptedTestBuild {
lazy val root = {
Project(
id = "main",
base = file("."),
settings = Defaults.defaultSettings ++ scriptedTestSettings ++ SbtXjcPlugin.xjcSettings ++ Seq(
resolvers += "Java Net" at "http://download.java.net/maven/2/"
)++ Seq(
sourceManaged in (Compile, SbtXjcPlugin.xjc) <<= sourceManaged
)
);
}
}