2

我正在使用sbt-xjc插件来生成我的 xml 类。

的默认值以 .sourceManaged开头xjc。我想删除xjc. 我该怎么做?

4

2 回答 2

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

于 2014-12-17T15:42:24.773 回答
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
      )
    );
  }
}
于 2014-02-10T20:52:23.263 回答