variations of scalaxb

scalaxb is an XML data-binding tool that supports xsd and wsdl, and as output it generates scala source files.
There are currently four ways of running scalaxb.

  1. command line app scalaxb
  2. sbt plugin sbt-scalaxb
  3. maven plugin mvn-scalaxb
  4. web API scalaxb-heroku hosted on heroku

They are all functionally equivalent: Takes your schema files and generates scala sources.
Because the project started with the command line application, so I used to use it mostly, but today I use sbt-scalaxb together with giter8 template. With the web API, all you need is a browser to try scalaxb.
My recommended approach is to use sbt-scalaxb if you're comfortable with sbt, and also get command line app scalaxb if you want to play around.

installing sbt-scalaxb

As long as you have sbt, sbt-scalaxb can be used just by writing a few lines in build definition. The same goes for mvn-scalaxb. You can move straight to sbt-scalaxb, but you might want to read conscript section of this page before that.

installing command line app

If you don't have it, install Java 6 SE. Then, install conscript (cs).

what's conscript?

conscript is a small utility that sets up command line apps that uses sbt's dependency management as the backend. Install scalaxb using it.

$ cs eed3si9n/scalaxb

When you install scalaxb using conscript, it creates ~/bin/scalaxb (a bash script for Unix, a batch file for Windows) and downloads launchconfig from github to ~/.conscript/eed3si9n/scalaxb/scalaxb/launchconfig. That's it!
The rest of the work is done by sbt's launcher called sbt-launcher.jar. The launchconfig contains the version number and the main module for scalaxb. sbt's launcher would automatically download that and all its dependent libraries from the web when scalaxb is installed.

This is much more convenient compared to downloading a jar and writing scripts every time you want to update scalaxb. Because it runs in its own environment, you don't have to worry about it contaminating your classpath.

running command line app

From Terminal app or Command Prompt, run:

$ scalaxb

If it works, move on to running scalaxb.

building from source