Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Code Generation from avsc files


Copy link to this message
-
Re: Code Generation from avsc files
I think your plugin configuration might be missing some lines.

Here's what mine looks like:
      <plugin>
        <groupId>org.apache.avro</groupId>
        <artifactId>avro-maven-plugin</artifactId>
        <version>${avro-version}</version>
        <executions>
          <execution>
            <id>schemas</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>protocol</goal>
            </goals>
            <configuration>
              <includes>
                <include>*.avpr</include>
              </includes>

<sourceDirectory>${project.basedir}/share/schemas/contrail/</sourceDirectory>

<outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>

I don't know if the compiler works with avsc files but assuming it does,
you'll probably need to either change or add an appropriate include:
e.g
<include> *.avsc</include>
You'll also want to change the sourcedirectory to the directory where your
schema files are located.

J
On Fri, Mar 30, 2012 at 6:32 AM, Deepak Nettem <[EMAIL PROTECTED]>wrote:

> Hi,
>
> I have a .avsc schema file in my maven project, and I am able to use it to
> write simple avro apps. However, I am not able to generate source code
> (classes) from the avro schema file to be able to use them in Avro
> MapReduce code.
>
> My pom.xml plugins section looks like this:
>
>     <plugins>
>     <plugin>
>             <artifactId>maven-assembly-plugin</artifactId>
>             <configuration>
>                 <archive>
>                     <manifest>
>                         <mainClass>org.avrotest.App</mainClass>
>                     </manifest>
>                 </archive>
>                  <manifestEntries>
>           <Class-Path>../target/classes</Class-Path>
>         </manifestEntries>
>                 <descriptorRefs>
>                     <descriptorRef>jar-with-dependencies</descriptorRef>
>                 </descriptorRefs>
>             </configuration>
>         </plugin>
>
>      <plugin>
>         <groupId>org.apache.avro</groupId>
>         <artifactId>avro-maven-plugin</artifactId>
>         <version>1.6.1</version>
>       </plugin>
>     </plugins>
>
> I package my jar by running
>
> mvn compile
> mvn assembly:single
>
> Best,
> Deepak
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB