<?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 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>
  <parent>
    <groupId>org.apache.phoenix</groupId>
    <artifactId>phoenix</artifactId>
    <version>5.3.1</version>
  </parent>
  <artifactId>phoenix-assembly</artifactId>
  <packaging>pom</packaging>
  <name>Phoenix Assembly</name>
  <description>Assemble Phoenix artifacts</description>

  <properties>
    <maven.test.skip>true</maven.test.skip>
    <source.skip>true</source.skip>
    <jacocoArgLine/>
    <main.basedir>${project.parent.basedir}</main.basedir>
  </properties>

  <dependencies>
    <!-- Depend on all other internal projects -->
    <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-server-${hbase.suffix}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-mapreduce-byo-shaded-hbase-${hbase.suffix}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-client-embedded-${hbase.suffix}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-client-lite-${hbase.suffix}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-pherf</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.phoenix</groupId>
      <artifactId>phoenix-tracing-webapp</artifactId>
    </dependency>
    <dependency>
      <groupId>sqlline</groupId>
      <artifactId>sqlline</artifactId>
      <version>${sqlline.version}</version>
      <classifier>jar-with-dependencies</classifier>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>embedded client without version</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <executable>ln</executable>
              <workingDirectory>${project.basedir}/../phoenix-client-parent/phoenix-client-embedded/target</workingDirectory>
              <arguments>
                <argument>-fnsv</argument>
                <argument>phoenix-client-embedded-${hbase.suffix}-${project.version}.jar</argument>
                <argument>
                  <!-- We are overwriting the unshaded client JAR, but we don't care -->
                  phoenix-client-embedded-${hbase.suffix}.jar
                </argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>lite client without version</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <executable>ln</executable>
              <workingDirectory>${project.basedir}/../phoenix-client-parent/phoenix-client-lite/target</workingDirectory>
              <arguments>
                <argument>-fnsv</argument>
                <argument>phoenix-client-lite-${hbase.suffix}-${project.version}.jar</argument>
                <argument>
                  <!-- We are overwriting the unshaded client JAR, but we don't care -->
                  phoenix-client-lite-${hbase.suffix}.jar
                </argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>server without version</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <executable>ln</executable>
              <workingDirectory>${project.basedir}/../phoenix-server/target</workingDirectory>
              <arguments>
                <argument>-fnsv</argument>
                <argument>phoenix-server-${hbase.suffix}-${project.version}.jar</argument>
                <argument>
                  <!-- We are overwriting the unshaded server JAR, but we don't care -->
                  phoenix-server-${hbase.suffix}.jar
                </argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>mapreduce without version</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <executable>ln</executable>
              <workingDirectory>${project.basedir}/../phoenix-mapreduce-byo-shaded-hbase/target</workingDirectory>
              <arguments>
                <argument>-fnsv</argument>
                <argument>phoenix-mapreduce-byo-shaded-hbase-${hbase.suffix}-${project.version}.jar</argument>
                <argument>
                  <!-- We are overwriting the unshaded  JAR, but we don't care -->
                  phoenix-mapreduce-byo-shaded-hbase-${hbase.suffix}.jar
                </argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>pherf without version</id>
            <goals>
              <goal>exec</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <executable>ln</executable>
              <workingDirectory>${project.basedir}/../phoenix-pherf/target</workingDirectory>
              <arguments>
                <argument>-fnsv</argument>
                <argument>phoenix-pherf-${project.version}.jar</argument>
                <argument>phoenix-pherf.jar</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- No jars created for this module -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>default-jar</id>
            <goals/>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>package-to-tar</id>
            <goals>
              <goal>single</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <finalName>phoenix-${hbase.suffix}-${project.version}-bin</finalName>
              <attach>false</attach>
              <tarLongFileMode>gnu</tarLongFileMode>
              <appendAssemblyId>false</appendAssemblyId>
              <descriptors>
                <descriptor>src/build/package-to-tar-all.xml</descriptor>
              </descriptors>
              <tarLongFileMode>posix</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>coverage</id>
      <dependencies>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-core</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix.thirdparty</groupId>
          <artifactId>phoenix-shaded-guava</artifactId>
          <version>${phoenix.thirdparty.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-tracing-webapp</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-hbase-compat-2.4.1</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-hbase-compat-2.5.0</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-hbase-compat-2.5.4</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-hbase-compat-2.6.0</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.apache.phoenix</groupId>
          <artifactId>phoenix-hbase-compat-2.6.4</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>report-aggregate</id>
                <goals>
                  <goal>report-aggregate</goal>
                </goals>
                <phase>verify</phase>
                <configuration>
                  <outputDirectory>${jacocoReportDir}</outputDirectory>
                  <sourceEncoding>${project.build.sourceEncoding}</sourceEncoding>
                  <outputEncoding>${project.reporting.outputEncoding}</outputEncoding>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
