avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deepak Nettem <deepaknet...@gmail.com>
Subject Re: Code Generation from avsc files
Date Fri, 30 Mar 2012 14:04:19 GMT
Thanks! That worked!

On Fri, Mar 30, 2012 at 9:57 AM, Jeremy Lewi <jeremy@lewi.us> wrote:

> 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 <deepaknettem@gmail.com>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
>>
>
>

Mime
View raw message