This page describes sbt-scalaxb for scalaxb 1.5.0 and above. See the following for older versions:

automate using sbt new

The following steps has been scripted into a giter8 template called eed3si9n/scalaxb.g8. For a quick project, run the following after installing sbt 0.13.13+.

$ sbt new eed3si9n/scalaxb.g8

scalaxb 0.6.5

breaking changes

In an effort to solve namespace conflicts and to increase consistency among the plugins, sbt plugins best practices was created. Here are the changes based on its recommendations:

keys are under ScalaxbKeys object

Keys provided by sbt-scalaxb now resides in ScalaxbKeys object. Place the following at the top of your build.sbt:

import ScalaxbKeys._

Scala identifiers for the keys remain the same (e.g. packageName), but key names accessible from the shell are now prefixed with scalaxb- (e.g. scalaxb-package-name).

settings are scoped under scalaxb task

scalaxb-specific settings are now scoped under scalaxb task. The default settings scalaxbSettings is scoped additionally by Compile configuration (no moreScalaxb configuration!).

seq(scalaxbSettings: _*)

packageName in scalaxb in Compile := "ipo"

sourceGenerators in Compile <+= scalaxb in Compile

If you wish to use scalaxb task multiple times in a project, you can do so by creating custom configurations in build.scala.

val Xsd = config("xsd") extend(Compile)
val Wsdl = config("wsdl") extend(Compile)
lazy val appSettings = buildSettings ++
  inConfig(Xsd)(baseScalaxbSettings ++ inTask(scalaxb)(customScalaxbSettings("xmlschema"))) ++
  inConfig(Wsdl)(baseScalaxbSettings ++ inTask(scalaxb)(customScalaxbSettings("wsdl11")))

def customScalaxbSettings(base: String): Seq[Project.Setting[_]] = Seq(
  sources <<= xsdSource map { xsd => Seq(xsd / (base + ".xsd")) },
  packageName := base,

bug fixes and minor enhancements

  • Fixes namespace binding conflict. #84 reported and fixed by jxstanford
  • Fixes anyType support in wsdl. #88 reported by radirk
  • Fixes SOAPAction header in wsdl.
  • Fixes Fault handling in wsdl.
  • Uses Logback internally for logging.

scalaxb 0.6.4

bug fixes and minor enhancements

  • Fixes sbt-scalaxb. #83
  • Fixes QName parsing to resolve URI. #82

scalaxb 0.6.3

bug fixes and minor enhancements

  • Fixes xs:gMonthDay support. #74
  • Fixes substitution group parsing. #79 reported by @jxstanford
  • Fixes SOAP 1.2 Content-Type HTTP header. #80
  • Adds RPC-style SOAP message support. #77
  • Changes the default protocol file name to xmlprotocol.scala.
  • Adds --protocol-file and --protocol-package option. #76
  • Duplicated types are now ignored. #78 requested by @timperrett

scalaxb 0.6.2

sbt-scalaxb for sbt 0.10.1

To call scalaxb from sbt 0.10.1, put this in your project/plugins/build.sbt:

libraryDependencies <+= (sbtVersion) { sv => "org.scalaxb" %% "sbt-scalaxb" % ("sbt" + sv + "_0.6.2") }

and this in build.sbt:

seq(sbtscalaxb.Plugin.scalaxbSettings: _*)

sourceGenerators in Compile <+= scalaxb.identity

bug fixes and minor enhancements

  • Adds --contents-limit option to set the limit of long sequence.
  • Adds --prepend-family option to prepend family name to classes generated from child elements (#69 reported by @devinus).
  • Adds soap 1.1 support (#66 reported by @s_m_stewart and @meglio)
  • All modules built using sbt 0.10.1.

wsdl feature the beginning

I wanted to share Tim's latest blog article Using SOAP with Scala with you guys.

It seems I have inadvertently become “that guy who does SOAP with Scala”.

Also wanted to share a bit of the background. I'd known SOAP was doable because majority of the WSDL is actually XSD, and also @max4f has implemented it. But originally, I was going to wait a while till I implement WSDL/SOAP support. What got me moving quicker was @timperrett's tweet on 4/26:

Has anyone ever built some kind of monadic abstraction on SOAP? If so, i want to hear your thoughts!

scalaxb 0.6.1

goodbye sbaz, hello conscript

sbaz allowed quick installation of scalaxb, but it also had its share of problems like scala version dependencies and contaminating the REPL classpath.
Starting 0.6.1, scalaxb will no longer be supporting sbaz and recommend all users to switch to conscript for installing scalaxb.

$ sudo sbaz remove scalaxb
$ cs eed3si9n/scalaxb

no Array

  • xs:base64Binary now maps to scalaxb.Base64Binary instead of Array[Byte].
  • Both scalaxb.HexBinary and scalaxb.Base64Binary are backed by Vector[Byte] internally.
  • Other built-in types that previously mapped to Array[String] now maps to Seq[String].


scalaxb plugin for Maven was contributed by @martiell.

sbt-scalaxb for sbt 0.10

To call scalaxb from sbt 0.10, put this in your project/plugins/build.sbt:

libraryDependencies += "org.scalaxb" %% "sbt-scalaxb" % "0.6.1"

and this in your build.sbt:

sourceGenerators in Compile <+= scalaxb.identity

bug fixes and minor enhancements

  • Fixes list derived types (#54 reported by @ikwzm).
  • Fixes handling of empty sequences (#55).
  • Fixes naming of local elements with duplicate name and structure (#56).
  • Adds @implicitNotFound attributes on fromXML etc.
  • Adds --no-runtime option to skip generating scalaxb.scala (#45 requested by @martiell).
  • Implements camel casing of wsdl operation name (#52 requested by @timperrett).
  • Removes X prefix on wsdl message case classes (#51 requested by @timperrett).
  • Adds --chunk-size option to handle 200+ parameters (#58 reported by @ecin).

mvn-scalaxb: Running scalaxb from Maven

Running scalaxb from Maven

The scalaxb-maven-plugin is provided to allow scalaxb to be run as part of a maven build.

vmware uses scalaxb and Salat

John Stanford talking about using scalaxb and Salat to persist case classes into MongoDB:
- Using Salat with scalaxb generated classes

He was also the first to post on the new scalaxb Google Group. Join us, and contribute your ideas.

scalaxb 0.6.0

new feature

bug fixes and other minor enhancements

  • XML bindings are generated as foo_xmlprotocol.scala.
  • Uses Scala 2.9.0-1.
  • Web API uses Unfiltered 0.3.3.
  • Adds default argument for xs:anyAttribute.
  • Adds support for xs:anySimpleType. (#34 reported by @psnively)
  • Fixes xs:any naming. (#35 reported by @psnively)
  • Adds typeclass instance for DataRecord. (#40 reported by @psnively)
  • Fixes DataRecord round trip. (#43)
  • Fixes mapping of xs:choice of xs:anyType. (#44 reported by @psnively)
Syndicate content