我正在使用sbt-xjc插件来生成我的xml类。
sourceManaged
的默认值前缀为xjc
。我想删除xjc
。我该怎么做?
答案 0 :(得分:0)
对我来说,将以下内容添加到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
)
);
}
}
答案 1 :(得分:0)
在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