<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <artifactId>zanata-common-api</artifactId>
  <name>Zanata Common API</name>
  <parent>
    <groupId>org.zanata</groupId>
    <artifactId>api</artifactId>
    <version>3.7.2</version>
  </parent>
  <packaging>jar</packaging>

  <!-- Should be the same as zanata-api/pom.xml -->
  <scm>
    <connection>scm:git:git://github.com/zanata/zanata-api.git</connection>
    <developerConnection>scm:git:git@github.com:zanata/zanata-api.git</developerConnection>
    <url>https://github.com/zanata/zanata-api</url>
    <tag>api-3.7.2</tag>
  </scm>

  <build>
    <resources>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.java</include>
          <include>**/*.gwt.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.*</include>
        </includes>
      </resource>
    </resources>

    <plugins>

      <!--
         This config is used when running mvn enunciate:docs.
         Docs will be generated in target/enunciate/build/docs/rest-api-docs.
         See also the reporting configuration.
       -->
      <plugin>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>maven-enunciate-plugin</artifactId>
        <configuration>
          <configFile>etc/enunciate/enunciate.xml</configFile>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.3</version>
        <configuration>
          <includes>
            <include>**/org/zanata/common/*.java</include>
            <include>**/org/zanata/rest/dto/**/*.java</include>
          </includes>
        </configuration>
      </plugin>

      <!-- Mandatory plugins for using Spock -->
      <plugin>
        <groupId>org.codehaus.gmaven</groupId>
        <artifactId>gmaven-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>setup</id>
            <phase>initialize</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <source>project.properties["version-as-java-package"] = "v" + project.version.replaceAll("[.-]", "_")</source>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>2.0</version>
        <executions>
          <execution>
            <id>compat</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>compat</shadedClassifierName>
              <artifactSet>
                <includes>
                  <include>org.zanata:zanata-common-api</include>
                </includes>
                <!-- otherwise, with maven-jar-plugin disabled, Maven tries to shade this module -->
                <!--<excludes>
                    <exclude>org.zanata:zanata-api-compat</exclude>
                </excludes>-->
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>org.zanata</pattern>
                  <shadedPattern>org.zanata.apicompat</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
          <execution>
            <id>versioned-compat</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>compat_${version-as-java-package}</shadedClassifierName>
              <artifactSet>
                <includes>
                  <include>org.zanata:zanata-common-api</include>
                </includes>
                <!-- otherwise, with maven-jar-plugin disabled, Maven tries to shade this module -->
                <!--<excludes>
                    <exclude>org.zanata:zanata-api-compat</exclude>
                </excludes>-->
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>org.zanata</pattern>
                  <shadedPattern>org.zanata.${version-as-java-package}</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>
            org.eclipse.m2e
          </groupId>
          <artifactId>
            lifecycle-mapping
          </artifactId>
          <version>
            1.0.0
          </version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>
                      org.codehaus.groovy.maven
                    </groupId>
                    <artifactId>
                      gmaven-plugin
                    </artifactId>
                    <versionRange>
                      [1.0,)
                    </versionRange>
                    <goals>
                      <goal>
                        execute
                      </goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <reporting>
    <plugins>
      <!--
         This config is used when running mvn site.
         Docs will be generated in target/site/rest-api-docs.
         See also the plugin configuration.
       -->
      <plugin>
        <groupId>org.codehaus.enunciate</groupId>
        <artifactId>maven-enunciate-plugin</artifactId>
        <!-- apparently pluginManagement is ignored in reporting -->
        <version>${enunciate.version}</version>
        <configuration>
          <configFile>etc/enunciate/enunciate.xml</configFile>

          <!--
          These two enunciate options are undocumented, but
          their absence causes an error during site generation.
           -->
          <enunciateArtifactId>unused</enunciateArtifactId>
          <moduleName>unused</moduleName>

          <docsSubdir>rest-api-docs</docsSubdir>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.enunciate</groupId>
      <artifactId>enunciate-core-annotations</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.annotation</groupId>
          <artifactId>jsr250-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.codehaus.enunciate</groupId>
      <artifactId>enunciate-jersey-rt</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator</artifactId>
      <exclusions>
        <exclusion>
          <groupId>xml-apis</groupId>
          <artifactId>xml-apis</artifactId>
        </exclusion>
      </exclusions>
      <!--this is needed for now. Aftet AS7 upgrade may need to revisit this-->
      <version>4.2.0.Final</version>
    </dependency>

    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>1.0.0.GA</version>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.annotation</groupId>
          <artifactId>jsr250-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxb-provider</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>jaxrs-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-multipart-provider</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.spockframework</groupId>
      <artifactId>spock-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>javax.xml.stream</groupId>
      <artifactId>stax-api</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
    </dependency>

  </dependencies>


</project>
