2

build.sbt 代码:我从http://scalaxb.org/sbt-scalaxb复制了代码

name := """DealerNext"""

version := "1.0-SNAPSHOT"

import ScalaxbKeys._

lazy val commonSettings = Seq(
  organization  := "com.dn",
  scalaVersion  := "2.11.5"
)

lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
lazy val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
lazy val dispatchV = "0.11.2" // change this to appropriate dispatch version
lazy val dispatch = "net.databinder.dispatch" %% "dispatch-core" % dispatchV

lazy val root = (project in file(".")).
  enablePlugins(PlayScala).
    settings(commonSettings: _*).
  settings(
    name          := "nada",
    libraryDependencies ++= Seq(dispatch),
    libraryDependencies ++= {
      if (scalaVersion.value startsWith "2.11") Seq(scalaXml, scalaParser)
      else Seq()
    }).
  settings(scalaxbSettings: _*).
  settings(
    sourceGenerators in Compile += (scalaxb in Compile).taskValue,
    dispatchVersion in (Compile, scalaxb) := dispatchV,
    async in (Compile, scalaxb)           := true
    packageName in (Compile, scalaxb)     := "generated"
    // packageNames in (Compile, scalaxb)    := Map(uri("http://schemas.microsoft.com/2003/10/Serialization/") -> "microsoft.serialization"),
    // logLevel in (Compile, scalaxb) := Level.Debug 
  )

scalaVersion := "2.11.6"
scalacOptions ++= Seq("-Xmax-classfile-name", "100")
libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test,
  "io.swagger" %% "swagger-play2" % "1.5.0",
  "com.typesafe.play" %% "anorm" % "2.4.0",
  filters,
  "net.kaliber" %% "play-s3" % "7.0.2"
)

resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
resolvers += "OSS Repo" at "https://oss.sonatype.org/content/repositories/snapshots"
resolvers += "Kaliber Internal Repository" at "https://jars.kaliber.io/artifactory/libs-release-local"
resolvers += Resolver.sonatypeRepo("public")

//"com.cloudphysics" % "jerkson_2.10" % "0.6.3"

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator

packageName in (Compile, scalaxb) := "generated" 这一行抛出以下错误

error: reference to packageName is ambiguous;
it is imported twice in the same scope by
import ScalaxbKeys._
and import _root_.com.typesafe.sbt.SbtNativePackager.autoImport._
    packageName in (Compile, scalaxb)     := "generated"
    ^

如果我评论该行,则 wsdl 文件不会被编译为 scala 文件。

4

1 回答 1

1

改变

import ScalaxbKeys._

import ScalaxbKeys.{packageName => scalaxbPackageName, _}

packageName in (Compile, scalaxb) := "generated"

scalaxbPackageName in (Compile, scalaxb) := "generated"

于 2016-09-07T16:32:54.697 回答