<?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.knox</groupId>
        <artifactId>gateway</artifactId>
        <version>1.4.0</version>
    </parent>

    <artifactId>gateway-release</artifactId>
    <name>gateway-release</name>
    <description>The gateway binary release packaging.</description>

    <profiles>
        <profile>
            <id>package</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-common-scripts</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/home/bin</outputDirectory>
                                    <overwrite>true</overwrite>
                                    <resources>
                                        <resource>
                                            <directory>${project.basedir}/../gateway-release-common/home/bin</directory>
                                            <includes>
                                                <include>*.sh</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <inherited>false</inherited>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>binary</id>
                                <phase>package</phase>
                                <goals><goal>single</goal></goals>
                                <configuration>
                                    <finalName>knox-${project.version}</finalName>
                                    <outputDirectory>../target/${project.version}</outputDirectory>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <descriptors>
                                        <descriptor>src/assembly.xml</descriptor>
                                    </descriptors>
                                    <tarLongFileMode>gnu</tarLongFileMode>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals><goal>run</goal></goals>
                                <configuration>
                                    <target>
                                        <checksum algorithm="SHA-256" fileext=".sha256">
                                            <fileset dir="../target/${project.version}">
                                                <include name="*.zip" />
                                                <include name="*.tar.gz" />
                                            </fileset>
                                        </checksum>
                                        <checksum algorithm="SHA-512" fileext=".sha512">
                                            <fileset dir="../target/${project.version}">
                                                <include name="*.zip" />
                                                <include name="*.tar.gz" />
                                            </fileset>
                                        </checksum>
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant-nodeps</artifactId>
                                <version>${ant-nodeps.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <!-- Using the dependency plugin to grab a dependency jar (gateway-service-definitions) and
                        unpack some resources into the build directory so that it can be included in the assembly.
                        The phase 'generate-resources' is chosen since it is not only the closest fit to the description
                        of the action, but more importantly, it is a phase that is guaranteed to occur before the
                        assembly which is tied to 'package'.
                        -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-services</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.apache.knox</groupId>
                                            <artifactId>gateway-service-definitions</artifactId>
                                            <type>jar</type>
                                            <overWrite>true</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                            <includes>services/**/*</includes>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.knox</groupId>
                                            <artifactId>gateway-applications</artifactId>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                            <includes>applications/**/*</includes>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.knox</groupId>
                                            <artifactId>gateway-applications</artifactId>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                            <includes>deployments/**/*</includes>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>org.apache.knox</groupId>
                                            <artifactId>gateway-shell-samples</artifactId>
                                            <type>jar</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>${project.build.directory}</outputDirectory>
                                            <includes>samples/**/*</includes>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
           <!-- Running this profile require you to have the 'shellcheck' tool installed on your DEV environment. Check out https://github.com/koalaman/shellcheck#installing for more information -->
           <activation>
               <property>
                   <name>shellcheck</name>
                   <value>true</value>
               </property>
           </activation>
           <build>
               <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>${exec-maven-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>shellcheck_verification</id>
                                <phase>validate</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <executable>shellcheck</executable>
                            <arguments>
                                <argument>-x</argument>
                                <!-- for any reason *.sh does not work if I run it from Maven; it's ok to do it in the command line -->
                                <argument>${project.basedir}/home/bin/ldap.sh</argument>
                                <argument>${project.basedir}/home/bin/gateway.sh</argument>
                                <argument>${project.basedir}/home/bin/knoxcli.sh</argument>
                            </arguments>
                        </configuration>
                    </plugin>
               </plugins>
           </build>
        </profile>
    </profiles>

    <dependencies>

        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>knox-cli-launcher</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-server-launcher</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-admin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-as</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-hbase</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-hive</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-impala</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-webhdfs</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-rm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-storm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-livy</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-jkg</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-tgs</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-knoxsso</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-knoxssout</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-knoxtoken</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-health</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-nifi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-nifi-registry</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-rewrite</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-rewrite-step-secure-query</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-rewrite-step-encrypt-uri</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-rewrite-func-hostmap-static</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-rewrite-func-service-registry</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-rewrite-func-inbound-query-param</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-shiro</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-jwt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-pac4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-webappsec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-clientcert</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-preauth</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-hadoopauth</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-authc-anon</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-authz-acls</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-security-authz-composite</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-identity-assertion-common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-identity-assertion-concat</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-identity-assertion-pseudo</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-identity-assertion-hadoop-groups</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-identity-assertion-regex</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-identity-assertion-switchcase</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-provider-ha</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>hadoop-examples</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-shell</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-shell-launcher</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-demo-ldap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-demo-ldap-launcher</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-applications</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-shell-samples</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-discovery-ambari</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-discovery-cm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-adapter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-hashicorp-vault</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-topology-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-cm-integration</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>gateway-service-metadata</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.knox</groupId>
            <artifactId>knox-homepage-ui</artifactId>
        </dependency>
    </dependencies>
</project>
