Pythoner
Pythoner

Reputation: 5595

How to compile avro schema in eclipse?

I'm testing to convert some files using Avro, I had added dependency as the guide of avro 1.7.7 suggest.

<dependency>
  <groupId>org.apache.avro</groupId>
  <artifactId>avro</artifactId>
  <version>1.7.7</version>
</dependency>

As well as the Avro Maven plugin (for performing code generation):

<plugin>
  <groupId>org.apache.avro</groupId>
  <artifactId>avro-maven-plugin</artifactId>
  <version>1.7.7</version>
  <executions>
    <execution>
      <phase>generate-sources</phase>
      <goals>
        <goal>schema</goal>
      </goals>
      <configuration>
        <sourceDirectory>${project.basedir}/src/main/avro/</sourceDirectory>
        <outputDirectory>${project.basedir}/src/main/java/</outputDirectory>
      </configuration>
    </execution>
  </executions>
</plugin>
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <source>1.6</source>
    <target>1.6</target>
  </configuration>
</plugin>

But this guide uses shell command to compile the avro schema user.avsc. I want to ask how to compile it in the eclipse IDE.

Upvotes: 4

Views: 5565

Answers (1)

Carlo Ledesma
Carlo Ledesma

Reputation: 446

As @Tunaki has suggested, I "Run as... > Maven install". Additionally, I updated added "target/generated-sources" to the Build Path so I can reference the auto-generated files.

Upvotes: 1

Related Questions