<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (C) 2015 The Gravitee team (http://gravitee.io)

    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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.gravitee.gateway.standalone</groupId>
        <artifactId>gravitee-gateway-standalone</artifactId>
    <version>3.5.21</version>
    </parent>

    <artifactId>gravitee-gateway-standalone-distribution</artifactId>
    <packaging>pom</packaging>
    <name>Gravitee.io APIM - Gateway - Standalone - Distribution</name>

    <properties>
        <!-- Properties used for building RPM & DEB package-->
        <packaging.gravitee.gateway.home.dir>/usr/share/gravitee-gateway</packaging.gravitee.gateway.home.dir>
        <packaging.gravitee.gateway.bin.dir>${packaging.gravitee.gateway.home.dir}/bin</packaging.gravitee.gateway.bin.dir>
        <packaging.gravitee.gateway.plugins.dir>${packaging.gravitee.gateway.home.dir}/plugins</packaging.gravitee.gateway.plugins.dir>
        <packaging.gravitee.gateway.apis.dir>${packaging.gravitee.gateway.home.dir}/apis</packaging.gravitee.gateway.apis.dir>
        <packaging.gravitee.gateway.conf.dir>/etc/gravitee-gateway</packaging.gravitee.gateway.conf.dir>
        <packaging.gravitee.gateway.log.dir>/var/log/gravitee-gateway</packaging.gravitee.gateway.log.dir>
        <packaging.gravitee.gateway.pid.dir>/var/run/gravitee-gateway</packaging.gravitee.gateway.pid.dir>
        <packaging.gravitee.gateway.services.dir>/etc/init.d</packaging.gravitee.gateway.services.dir>
        <packaging.gravitee.gateway.user>gravitee</packaging.gravitee.gateway.user>
        <packaging.gravitee.gateway.group>gravitee</packaging.gravitee.gateway.group>
    </properties>

    <modules>
        <module>zip</module>
    </modules>


    <dependencies>
        <!-- Gravitee dependencies -->
        <dependency>
            <groupId>io.gravitee.gateway.standalone</groupId>
            <artifactId>gravitee-gateway-standalone-bootstrap</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.gravitee.gateway.standalone</groupId>
            <artifactId>gravitee-gateway-standalone-container</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>io.gravitee.gateway.services</groupId>
            <artifactId>gravitee-gateway-services-healthcheck</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.gateway.services</groupId>
            <artifactId>gravitee-gateway-services-sync</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.gateway.services</groupId>
            <artifactId>gravitee-gateway-services-localregistry</artifactId>
            <version>${project.version}</version>
            <type>zip</type>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.node.services</groupId>
            <artifactId>gravitee-node-services-healthcheck</artifactId>
            <version>${gravitee-node.version}</version>
            <type>zip</type>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.node.services</groupId>
            <artifactId>gravitee-node-services-monitoring</artifactId>
            <version>${gravitee-node.version}</version>
            <type>zip</type>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>io.gravitee.gateway.services</groupId>
            <artifactId>gravitee-gateway-services-heartbeat</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
            <type>zip</type>
        </dependency>

        <dependency>
            <groupId>io.gravitee.gateway.services</groupId>
            <artifactId>gravitee-gateway-services-endpoint-discovery</artifactId>
            <version>${project.version}</version>
            <scope>runtime</scope>
            <type>zip</type>
        </dependency>
    </dependencies>

    <build>
        <finalName>distribution</finalName>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-plugins</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/staging</outputDirectory>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>io.gravitee.gateway.services</groupId>
                                    <artifactId>gravitee-gateway-services-healthcheck</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>io.gravitee.gateway.services</groupId>
                                    <artifactId>gravitee-gateway-services-sync</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>io.gravitee.gateway.services</groupId>
                                    <artifactId>gravitee-gateway-services-localregistry</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>io.gravitee.gateway.services</groupId>
                                    <artifactId>gravitee-gateway-services-heartbeat</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>io.gravitee.gateway.services</groupId>
                                    <artifactId>gravitee-gateway-services-endpoint-discovery</artifactId>
                                    <version>${project.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>io.gravitee.node.services</groupId>
                                    <artifactId>gravitee-node-services-healthcheck</artifactId>
                                    <version>${gravitee-node.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>io.gravitee.node.services</groupId>
                                    <artifactId>gravitee-node-services-monitoring</artifactId>
                                    <version>${gravitee-node.version}</version>
                                    <type>zip</type>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.6</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>bin</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>src/main/assembly/distribution.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
