<?xml version="1.0" encoding="UTF-8"?>
<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<project
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
  xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>avro-parent</artifactId>
    <groupId>org.apache.avro</groupId>
    <version>1.9.0</version>
    <relativePath>../</relativePath>
  </parent>

  <artifactId>avro-compiler</artifactId>

  <name>Apache Avro Compiler</name>
  <packaging>bundle</packaging>
  <url>http://avro.apache.org</url>
  <description>Compilers for Avro IDL and Avro Specific Java API</description>

  <properties>
    <main.basedir>${project.parent.parent.basedir}</main.basedir>
    <osgi.import>
      !org.apache.avro.compiler*,
      org.apache.avro*;version="${project.version}",
      org.apache.commons.lang3*,
      *
    </osgi.import>
    <osgi.export>org.apache.avro.compiler*;version="${project.version}"</osgi.export>
  </properties>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/velocity</directory>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/main/velocity</directory>
      </testResource>
      <testResource>
        <directory>src/test/idl</directory>
      </testResource>
    </testResources>
    <plugins>
      <!-- Avro generates a parser class with javacc. By default, this looks in src/main/javacc
        and outputs to target/generated-sources/javacc See http://mojo.codehaus.org/javacc-maven-plugin/javacc-mojo.html
        for more info on using this plugin. -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>javacc-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>javacc</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>javacc</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!-- some tests hang if not run in a separate JVM -->
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
          <parallel>none</parallel>
          <systemPropertyVariables>
            <test.idl.dir>${project.basedir}/src/test/idl</test.idl.dir>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>java</executable>
              <workingDirectory>/tmp</workingDirectory>
              <classpathScope>test</classpathScope>
              <arguments>
                <argument>-classpath</argument>
                <classpath></classpath>
                <argument>org.apache.avro.compiler.specific.SchemaTask</argument>
                <argument>${project.basedir}/src/test/resources/full_record_v1.avsc</argument>
                <argument>${project.basedir}/src/test/resources/full_record_v2.avsc</argument>
                <argument>${project.basedir}/target/generated-test-sources</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <!--
              Usually code is generated using a special-purpose maven plugin and the plugin
              automatically adds the generated sources into project.
              Here since general-purpose exec plugin is used for generating code, we need to manually
              add the sources.
            -->
            <id>add-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.basedir}/target/generated-test-sources</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <versionRange>[1.0,)</versionRange>
                    <goals>
                      <goal>exec</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute/>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>


  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>avro</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>${commons-lang.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.velocity</groupId>
      <artifactId>velocity-engine-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant</artifactId>
      <version>${ant.version}</version>
      <!-- can only be used from within ant -->
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
    </dependency>
  </dependencies>

</project>
