<?xml version="1.0"?>
<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/maven-v4_0_0.xsd">
  <!--
   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.
-->
  <parent>
    <groupId>org.apache.slider.packages</groupId>
    <artifactId>slider-app-packages</artifactId>
    <version>0.80.0-incubating</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>slider-accumulo-app-package</artifactId>
  <packaging>jar</packaging>
  <name>Slider Accumulo App Package</name>
  <description>Slider Accumulo App Package</description>

  <properties>
    <work.dir>package-tmp</work.dir>
    <app.package.name>${project.artifactId}-${pkg.version}</app.package.name>
    <pkg.src>${project.build.directory}/${work.dir}</pkg.src>
    <pkg.version>${project.version}</pkg.version>
    <pkg.name>accumulo-${accumulo.version}-bin.tar.gz</pkg.name>
    <!-- the following properties are used for testing -->
    <slider.bin.dir>../../slider-assembly/target/slider-${project.version}-all/slider-${project.version}</slider.bin.dir>
    <test.app.pkg.dir>${project.build.directory}</test.app.pkg.dir>
    <test.app.resources.dir>${project.build.directory}/test-config</test.app.resources.dir>
    <test.client.install.dir>${project.build.directory}/client-install-dir</test.client.install.dir>
    <!-- these properties are used in the default and the test appConfigs -->
    <hadoop.dir>/usr/lib/hadoop</hadoop.dir>
    <hdfs.dir>/usr/lib/hadoop-hdfs</hdfs.dir>
    <yarn.dir>/usr/lib/hadoop-yarn</yarn.dir>
    <mapred.dir>/usr/lib/hadoop-mapred</mapred.dir>
    <zk.dir>/usr/lib/zookeeper</zk.dir>
    <app.java.home>${java.home}</app.java.home>
    <app.user>yarn</app.user>
    <app.user.group>hadoop</app.user.group>
    <!-- these are for accumulo processes -->
    <accumulo.keytab />
    <accumulo.principal />
    <!-- these are for the AM -->
    <accumulo.headless.keytab>${accumulo.keytab}</accumulo.headless.keytab>
    <accumulo.headless.principal>${accumulo.principal}</accumulo.headless.principal>
  </properties>

  <profiles>
    <profile>
      <id>hdp</id>
      <properties>
        <hadoop.dir>/usr/hdp/current/hadoop-client</hadoop.dir>
        <hdfs.dir>/usr/hdp/current/hadoop-hdfs-client</hdfs.dir>
        <yarn.dir>/usr/hdp/current/hadoop-yarn-client</yarn.dir>
        <mapred.dir>/usr/hdp/current/hadoop-mapreduce-client</mapred.dir>
        <zk.dir>/usr/hdp/current/zookeeper-client</zk.dir>
        <slider.dir>/usr/hdp/current/slider-client</slider.dir>
      </properties>
    </profile>
    <profile>
      <id>accumulo-app-package</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven-assembly-plugin.version}</version>
            <configuration>
              <descriptor>src/assembly/accumulo.xml</descriptor>
              <appendAssemblyId>false</appendAssemblyId>
              <finalName>${app.package.name}</finalName>
            </configuration>
            <executions>
              <execution>
                <id>build-app-package</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>${maven-antrun-plugin.version}</version>
            <executions>
              <execution>
                <id>copy</id>
                <phase>validate</phase>
                <configuration>
                  <target name="copy and rename file">
                    <copy file="${pkg.src}/${pkg.name}" tofile="${project.build.directory}/${work.dir}/${pkg.name}" />
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>accumulo-app-package-maven</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.accumulo</groupId>
          <artifactId>accumulo</artifactId>
          <version>${accumulo.version}</version>
          <classifier>bin</classifier>
          <type>tar.gz</type>
          <exclusions>
            <exclusion>
              <groupId>org.apache.accumulo</groupId>
              <artifactId>accumulo-fate</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.accumulo</groupId>
              <artifactId>accumulo-gc</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.accumulo</groupId>
              <artifactId>accumulo-master</artifactId>
            </exclusion>
            <exclusion>
              <groupId>org.apache.accumulo</groupId>
              <artifactId>accumulo-minicluster</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>${maven-assembly-plugin.version}</version>
            <configuration>
              <descriptor>src/assembly/accumulo.xml</descriptor>
              <appendAssemblyId>false</appendAssemblyId>
              <finalName>${project.artifactId}-${pkg.version}</finalName>
            </configuration>
            <executions>
              <execution>
                <id>build-app-package</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>${maven-dependency-plugin.version}</version>
            <executions>
              <execution>
                <id>copy-dependencies</id>
                <phase>process-resources</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <includeArtifactIds>accumulo</includeArtifactIds>
                  <includeTypes>tar.gz</includeTypes>
                  <excludeTransitive>true</excludeTransitive>
                  <outputDirectory>${project.build.directory}/${work.dir}</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>accumulo-funtest</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${maven-failsafe-plugin.version}</version>
            <executions>
              <execution>
                <id>run-integration-tests</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <systemPropertyVariables>
                <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
                <java.awt.headless>true</java.awt.headless>
                <!-- this property must be supplied-->
                <slider.conf.dir>${slider.conf.dir}</slider.conf.dir>
                <slider.bin.dir>${slider.bin.dir}</slider.bin.dir>
                <test.app.pkg.dir>${test.app.pkg.dir}</test.app.pkg.dir>
                <test.app.pkg.file>${app.package.name}.zip</test.app.pkg.file>
                <test.app.pkg.name>ACCUMULO</test.app.pkg.name>
                <test.app.resources.dir>${test.app.resources.dir}</test.app.resources.dir>
                <test.client.install.dir>${test.client.install.dir}</test.client.install.dir>
                <test.client.home.dir>${test.client.install.dir}/accumulo-${accumulo.version}</test.client.home.dir>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <!-- resources are filtered for dynamic updates. This gets build info in-->
    <resources>
      <resource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <targetPath>${test.app.resources.dir}</targetPath>
      </resource>
      <resource>
        <directory>.</directory>
        <filtering>true</filtering>
        <targetPath>${test.app.resources.dir}</targetPath>
        <includes>
          <include>appConfig-default.json</include>
          <include>appConfig-ssl-default.json</include>
          <include>clientInstallConfig-default.json</include>
        </includes>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven-compiler-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>${groovy-eclipse-compiler.version}</version>
          </dependency>
          <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-batch</artifactId>
            <version>${groovy-eclipse-batch.version}</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.accumulo</groupId>
      <artifactId>accumulo-server-base</artifactId>
      <version>${accumulo.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.accumulo</groupId>
      <artifactId>accumulo-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>${hadoop.version}</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.accumulo</groupId>
      <artifactId>accumulo-proxy</artifactId>
      <version>${accumulo.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.accumulo</groupId>
      <artifactId>accumulo-examples-simple</artifactId>
      <version>${accumulo.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.thrift</groupId>
      <artifactId>libthrift</artifactId>
      <version>0.9.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.accumulo</groupId>
      <artifactId>accumulo-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.slider</groupId>
      <artifactId>slider-funtest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-all</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-configuration</groupId>
      <artifactId>commons-configuration</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

</project>
