A simple example of how to use the Avro Maven plugin to generate Avro sources.
Clone or download
Latest commit 78aae98 May 24, 2013
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main fixed url May 24, 2013
LICENSE first cut May 24, 2013
README.md expanded the examples May 24, 2013
pom-schema-fulldefs.xml fixed url May 24, 2013
pom.xml fixed url May 24, 2013


Avro Maven

Some simple examples of how to use the Avro Maven plugin to generate Avro sources given an Avro schema, protocol or IDL file.


Apache version 2.0 (for more details look at LICENSE.


Download the sources:

bash $ git clone git://github.com/alexholmes/avro-maven.git

Run Avro's code generation against the Avro files contained in src/main/avro ( weather.avsc, weather.avpr and weather.avdl ) using Maven:

$ cd avro-maven/
$ mvn clean compile

Examine the code-generated sources:

$ find . -type f -name *.java src/main/java/com/alexholmes/avro/Weather.java

The Magic

The complete Maven file can be viewed in pom.xml.

The key is in adding the following plugin to your pom.xml file:


You'll also need to include Avro as a dependency:




Customizing the plugin

If you want to customize the location of the source or destination files, as well as other settings, take a look at pom-schema-fulldefs.xml, as well as my blog post giving more details on the subject at http://grepalex.com/2013/05/24/avro-maven/.

To see the customized pom.xml in action, use the following command:

$ mvn clean compile -f pom-schema-fulldefs.xml

The generated output files can be seen with the find command:

$ find . -type f -name *.java