<?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/xsd/maven-4.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.
     */
    -->
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <artifactId>hbase</artifactId>
    <groupId>org.apache.hbase</groupId>
    <version>1.3.1.0200-mrs-1.6.0</version>
    <relativePath>..</relativePath>
  </parent>
  <artifactId>hbase-assembly</artifactId>
  <name>Apache HBase - Assembly</name>
  <description>
        Module that does project assembly and that is all that it does.
    </description>
  <packaging>pom</packaging>
  <properties>
    <license.bundles.dependencies>true</license.bundles.dependencies>
  </properties>
  <build>
    <plugins>
      <!-- licensing info from our dependencies -->
     <!-- <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>default</id>
            <configuration>
              <properties>
                <copyright-end-year>${build.year}</copyright-end-year>
                <debug-print-included-work-info>${license.debug.print.included}</debug-print-included-work-info>
                <bundled-dependencies>${license.bundles.dependencies}</bundled-dependencies>
                <bundled-jquery>${license.bundles.jquery}</bundled-jquery>
                <bundled-logo>${license.bundles.logo}</bundled-logo>
                <bundled-bootstrap>${license.bundles.bootstrap}</bundled-bootstrap>
              </properties>
              <resourceBundles>
                <resourceBundle>${project.groupId}:hbase-resource-bundle:${project.version}</resourceBundle>
              </resourceBundles>
              <supplementalModelArtifacts>
                <supplementalModelArtifact>${project.groupId}:hbase-resource-bundle:${project.version}</supplementalModelArtifact>
              </supplementalModelArtifacts>
              <supplementalModels>
                <supplementalModel>supplemental-models.xml</supplementalModel>
              </supplementalModels>
            </configuration>
          </execution>
        </executions>
      </plugin>-->
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>${maven.assembly.version}</version>
        <executions>
          <execution>
            <id>tarball</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
        <configuration>
          <!--Else will use hbase-assembly as final name.-->
              <finalName>hbase</finalName>
          <skipAssembly>false</skipAssembly>
             <appendAssemblyId>false</appendAssemblyId>
          <!--We do not want assembly attached; run on command-line explicitly
               if you want to do an assembly-->
          <attach>false</attach>
          <tarLongFileMode>gnu</tarLongFileMode>
          <descriptors>
            <descriptor>${assembly.file}</descriptor>
          </descriptors>
        </configuration>
          </execution>
          <execution>
            <id>client</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <finalName>hbase-client</finalName>
             <skipAssembly>false</skipAssembly>
             <appendAssemblyId>false</appendAssemblyId>
             <descriptors>
               <descriptor>src/main/assembly/client.xml</descriptor>
             </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <configuration>
            <skip>true</skip>
          </configuration>
        </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
	        <!-- generates the file that will be used by the bin/hbase script in the dev env -->
            <id>create-hbase-generated-classpath</id>
            <phase>test</phase>
            <goals>
              <goal>build-classpath</goal>
            </goals>
            <configuration>
              <outputFile>${project.parent.basedir}/target/cached_classpath.txt</outputFile>
            </configuration>
          </execution>
        <!--
           Build an aggregation of our templated NOTICE file and the NOTICE files in our dependencies.
           If MASSEMBLY-382 is fixed we could do this in the assembly
           Currently relies on env, bash, find, and cat.
        -->
         <!-- <execution> -->
            <!-- put all of the NOTICE files out of our dependencies -->
           <!-- <id>unpack-dependency-notices</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
              <includes>**\/NOTICE,**\/NOTICE.txt</includes>
            </configuration>
          </execution> -->
          <execution>
            <id>copy</id>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>jline</groupId>
                    <artifactId>jline</artifactId>
                    <version>${jline.version}</version>
                    <type>jar</type>
                   <overWrite>false</overWrite>
                   <outputDirectory>${project.build.directory}/hbase/hbase/lib/jline</outputDirectory>                  
                </artifactItem>
              </artifactItems>             
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.4.0</version>
        <executions>
          <execution>
            <id>concat-NOTICE-files</id>
            <phase>package</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>env</executable>
              <arguments>
                <argument>bash</argument>
                <argument>-c</argument>
                <argument>cat maven-shared-archive-resources/META-INF/NOTICE \
                  `find ${project.build.directory}/dependency -iname NOTICE -or -iname NOTICE.txt` \
                </argument>
              </arguments>
              <outputFile>${project.build.directory}/NOTICE.aggregate</outputFile>
              <workingDirectory>${project.build.directory}</workingDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin> -->
      <!-- /end building aggregation of NOTICE files -->
	  <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.6</version>
        <executions>
            <execution>
                <id>package</id>
                <phase>package</phase>
                <configuration>
                   <target>
                     <!-- Complements the assembly -->
                     <mkdir dir="${project.build.directory}/hbase-client"/> 
					 <mkdir dir="${project.build.directory}/hbase-client/resources/org/apache/hadoop/hbase/thrift"/> 
					 <mkdir dir="${project.build.directory}/hbase-client/resources/org/apache/hadoop/hbase/thrift2"/> 
                     <tstamp>
                        <format property="NOW" pattern="yyyy-MM-dd HH:mm:ss" locale="en" />
                     </tstamp>
                     <!-- property setting for version.property file. -->
                     <property name="project.vendor" value="Huawei"/>
                     <!--  creating version.proverties file -->
                     <propertyfile
                        file="${project.build.directory}/hbase/hbase/version.properties"
                        comment="Project properties" >
                        <entry  key="name" value="${release.package.title}"/>
                        <entry  key="title" value="${release.package.title}"/>
                        <entry  key="version" value="${project.version}"/>
                        <entry  key="HW_display_version" value="${project.version}"/>
                        <entry  key="HW_internal_version" value="${release.internal.version}"/>
                        <entry  key="vendor" value="Huawei"/>
                        <entry  key="buildtime" value="@NOW"/>
                    </propertyfile>
                    <replace file="${project.build.directory}/hbase/hbase/version.properties" token="@NOW" value="${NOW}" />
                    <propertyfile
                        file="${project.build.directory}/hbase-client/version.properties"
                        comment="Project properties" >
                   <entry  key="name" value="${release.package.title}"/>
                        <entry  key="title" value="${release.package.title}"/>
                        <entry  key="version" value="${project.version}"/>
                        <entry  key="HW_display_version" value="${project.version}"/>
                        <entry  key="HW_internal_version" value="${release.internal.version}"/>
                        <entry  key="vendor" value="Huawei"/>
                        <entry  key="buildtime" value="@NOW"/>
                    </propertyfile>
                    <replace file="${project.build.directory}/hbase-client/version.properties" token="@NOW" value="${NOW}" />
                    <!-- add version.properties file in tar. -->
                    <!-- Using Unix tar to preserve symlinks -->
                    <echo file="${project.build.directory}/maketar.sh">
                         which cygpath 2&gt; /dev/null
                         if [ $? = 1 ]; then
                              BUILD_DIR="${project.build.directory}"
                         else
                              BUILD_DIR=`cygpath --unix '${project.build.directory}'`
                         fi
                         rm -rf $BUILD_DIR/hbase/hbase/lib/*test*.jar
                         rm -rf $BUILD_DIR/hbase-client/lib/*test*.jar
                         cd $BUILD_DIR/hbase
                         chmod 400 hbase/version.properties
                         chmod 400 hbase/*.txt	
                         chmod 600 hbase/conf/*
                         chmod -R 500 hbase/bin/*
                         chmod -R 500 hbase/lib/*
                         chmod -R 0500 hbase/hbase-webapps/*
                         chmod 700 $(find . -type d)
                         rm -rf hbase/bin/test/
                         tar czf $BUILD_DIR/${release.package.title}_${project.version}.tar.gz hbase
                         cp hbase/lib/hbase-client-${project.version}.jar $BUILD_DIR/hbase-client
                        <!-- cp hbase/lib/hbase-hindex-${project.version}.jar $BUILD_DIR/hbase-client/lib-->
                         cd $BUILD_DIR   
                         cp $BUILD_DIR/../../hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift $BUILD_DIR/hbase-client/resources/org/apache/hadoop/hbase/thrift/Hbase.thrift
                         cp $BUILD_DIR/../../hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift $BUILD_DIR/hbase-client/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
                         chmod 400 hbase-client/version.properties
                         tar czvf $BUILD_DIR/${release.package.title}-Client_${project.version}.tar.gz hbase-client
                   </echo>
                   <exec executable="sh" dir="${project.build.directory}" failonerror="yes">
                      <arg line="./maketar.sh"/>
                   </exec>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
	<!-- Intra-project dependencies -->
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-it</artifactId>
      <type>test-jar</type>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-thrift</artifactId>
    </dependency>
    <!-- To dump tools in hbase-procedure into cached_classpath.txt. -->
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-procedure</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-procedure</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>hbase-hadoop-compat</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.hbase</groupId>
        <artifactId>${compat.module}</artifactId>
        <version>${project.version}</version>
    </dependency>
    <dependency>
       <groupId>org.apache.hbase</groupId>
       <artifactId>hbase-shell</artifactId>
       <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.hbase</groupId>
      <artifactId>hbase-external-blockcache</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
       <groupId>org.apache.hbase</groupId>
       <artifactId>hbase-testing-util</artifactId>
       <version>${project.version}</version>
    </dependency>
    <dependency>
       <groupId>org.apache.hbase</groupId>
       <artifactId>hbase-resource-bundle</artifactId>
       <version>${project.version}</version>
       <optional>true</optional>
    </dependency>
  </dependencies>
</project>
