<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed 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 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                       https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.apache.ozone</groupId>
    <artifactId>ozone</artifactId>
    <version>2.0.0</version>
  </parent>
  <artifactId>ozone-httpfsgateway</artifactId>
  <version>2.0.0</version>
  <packaging>jar</packaging>

  <name>Apache Ozone HttpFS</name>
  <description>Apache Ozone HttpFS</description>

  <properties>
    <classpath.skip>false</classpath.skip>
    <httpfs.build.timestamp>${maven.build.timestamp}</httpfs.build.timestamp>
    <httpfs.source.repository>REPO NOT AVAIL</httpfs.source.repository>
    <httpfs.source.revision>REVISION NOT AVAIL</httpfs.source.revision>
    <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ssZ</maven.build.timestamp.format>
  </properties>

  <dependencies>
    <dependency>
      <groupId>ch.qos.reload4j</groupId>
      <artifactId>reload4j</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>com.googlecode.json-simple</groupId>
      <artifactId>json-simple</artifactId>
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>jakarta.ws.rs</groupId>
      <artifactId>jakarta.ws.rs-api</artifactId>
    </dependency>
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.ozone</groupId>
      <artifactId>hdds-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.ozone</groupId>
      <artifactId>hdds-config</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.ozone</groupId>
      <artifactId>hdds-hadoop-dependency-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.ozone</groupId>
      <artifactId>hdds-server-framework</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.ozone</groupId>
      <artifactId>ozone-filesystem-common</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-webapp</artifactId>
    </dependency>
    <dependency>
      <groupId>org.glassfish.hk2</groupId>
      <artifactId>hk2-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.inject</groupId>
      <artifactId>jersey-hk2</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.curator</groupId>
      <artifactId>curator-framework</artifactId>
      <scope>runtime</scope>
      <!-- These were excluded as non of them is used in the HttpFS module, but all of them would be a new unnecessary
       dependency to the Ozone project, we would also need to update the jar-report.txt with that. -->
      <exclusions>
        <exclusion>
          <groupId>com.sun.mail</groupId>
          <artifactId>javax.mail</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>jline</groupId>
          <artifactId>jline</artifactId>
        </exclusion>
        <exclusion>
          <groupId>log4j</groupId>
          <artifactId>log4j</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.commons</groupId>
          <artifactId>commons-math</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.apache.yetus</groupId>
          <artifactId>audience-annotations</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-log4j12</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.ozone</groupId>
      <artifactId>ozone-filesystem</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-reload4j</artifactId>
      <scope>runtime</scope>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>src/main/resources</directory>
        <includes>
          <include>httpfs.properties</include>
        </includes>
      </resource>
      <resource>
        <filtering>false</filtering>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>httpfs.properties</exclude>
        </excludes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <filtering>false</filtering>
        <directory>${basedir}/src/test/resources</directory>
      </testResource>
      <testResource>
        <filtering>true</filtering>
        <directory>${basedir}/src/test/resources</directory>
      </testResource>
    </testResources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <includeTestSourceDirectory>false</includeTestSourceDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <proc>none</proc>
        </configuration>
      </plugin>
      <plugin>
        <!-- workaround for filtered/unfiltered resources in same directory -->
        <!-- remove when maven-eclipse-plugin 2.9 is available -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.10</version>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <testFailureIgnore>${ignoreTestFailure}</testFailureIgnore>
          <threadCount>1</threadCount>
          <forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
          <properties>
            <property>
              <name>listener</name>
              <value>org.apache.hadoop.test.TimedOutTestsListener</value>
            </property>
          </properties>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>javadoc-no-fork</goal>
            </goals>
            <phase>site</phase>
            <configuration>
              <quiet>true</quiet>
              <verbose>false</verbose>
              <source>${maven.compile.source}</source>
              <charset>${maven.compile.encoding}</charset>
              <groups>
                <group>
                  <title>HttpFs API</title>
                  <packages>*</packages>
                </group>
              </groups>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>create-web-xmls</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-test-resources</phase>
            <configuration>
              <target>
                <mkdir dir="${project.build.directory}/test-classes/webapp" />

                <copy todir="${project.build.directory}/test-classes/webapp">
                  <fileset dir="${basedir}/src/main/webapp" />
                </copy>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>site</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>site</phase>
            <configuration>
              <target>
                <xslt in="${basedir}/src/main/resources/httpfs-default.xml" out="${project.build.directory}/site/httpfs-default.html" style="${basedir}/src/site/configuration.xsl" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <configuration>
          <excludeFilterFile>${basedir}/dev-support/findbugsExcludeFile.xml</excludeFilterFile>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>dist</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <dependencies>
              <dependency>
                <groupId>org.apache.hadoop</groupId>
                <artifactId>hadoop-assemblies</artifactId>
                <version>${hadoop.version}</version>
              </dependency>
            </dependencies>
            <executions>
              <execution>
                <id>dist</id>
                <goals>
                  <goal>single</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <finalName>${project.artifactId}-${project.version}</finalName>
                  <appendAssemblyId>false</appendAssemblyId>
                  <attach>false</attach>
                  <descriptorRefs>
                    <descriptorRef>hadoop-httpfs-dist</descriptorRef>
                  </descriptorRefs>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
