sbt-avro

sbt-avro is a plugin for sbt-0.12.1 that generates Java sources for Avro schemas and protocols.

Usage

Install the plugin

Add the plugin according to the sbt documentation.

For instance, add the following lines to the file hello/project/build.sbt in your project directory:

resolvers += "cavorite" at "http://files.cavorite.com/maven/"

addSbtPlugin("com.cavorite" % "sbt-avro" % "0.2")

Import the plugin settings

To activate the plugin, import its settings by adding the following lines to your hello/build.sbt file:

seq( sbtavro.SbtAvro.avroSettings : _*)

Scope

All settings and tasks are in the avro scope. If you want to execute the generate task directly, just run avro:generate.

Settings

Name Name in shell Default Description
sourceDirectory source-directory src/main/avro Path containing *.avsc and *.avpr files.
javaSource java-source $sourceManaged/compiled_avro Path for the generated *.java files.
version version 1.7.2

Version of the Avro library should be used.

A dependency to "org.apache.avro" % "avro-compiler" % "$version" is automatically added to libraryDependencies.

Tasks

Name Name in shell Description
generate generate Compiles the Avro files. This task is automatically executed everytime the project is compiled.

Source code

The source code is hosted in GitHub: https://github.com/cavorite/sbt-avro. Feel free to fork the repository, submit your bug reports, questions and comments.

License

This program is distributed under the BSD license. See the file LICENSE for more details.

Credits

sbt-avro is maintained by Juan Manuel Caicedo. I wrote it based on sbt-protobuf (even this README file!). This is my first attempt to write an sbt plugin, so feel free to send your comments and bug reports.

Changelog

Version 0.2 (2012-11-11)

Updated to the latest stable versions of sbt (0.12.1) and Avro (1.7.2). Thanks to Brennan Saeta.

Version 0.1 (2012-01-20)

Initial release. Based on the source code of sbt-protobuf.

Last update: November 11, 2012.