<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. 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/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.wso2.ei</groupId>
        <artifactId>wso2-micro-integrator-parent</artifactId>
        <version>4.1.0-alpha</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2mi</artifactId>
    <packaging>pom</packaging>
    <name>WSO2 Micro Integrator - Distribution</name>
    <url>http://www.wso2.org/projects/esb/java</url>
    <description>WSO2 Micro Integrator Distribution</description>

    <dependencies>
        <dependency>
            <groupId>org.wso2.ei</groupId>
            <artifactId>org.wso2.micro.integrator.business.messaging.hl7</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.org.apache.openjpa</groupId>
            <artifactId>openjpa-all</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.ei</groupId>
            <artifactId>org.wso2.micro.integrator.server</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.ei</groupId>
            <artifactId>utsecurity</artifactId>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.rampart</groupId>
            <artifactId>rampart</artifactId>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>addressing</artifactId>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>javax.jms-api</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>Saxon-HE</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.ei</groupId>
            <artifactId>org.wso2.micro.integrator.bootstrap</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.woodstox</groupId>
            <artifactId>woodstox-core-asl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-jcl</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.lmax</groupId>
            <artifactId>disruptor</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>unpack-wso2carbon</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wso2.carbon</groupId>
                                    <artifactId>wso2carbon-core</artifactId>
                                    <version>${carbon.kernel.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>dist</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <tarLongFileMode>posix</tarLongFileMode>
                            <filters>
                                <filter>${basedir}/src/assembly/filter.properties</filter>
                            </filters>
                            <descriptors>
                                <descriptor>${basedir}/src/assembly/bin.xml</descriptor>
                            </descriptors>
                            <archiverConfig>
                                <defaultDirectoryMode>0775</defaultDirectoryMode>
                                <directoryMode>0775</directoryMode>
                                <defaultFileMode>0644</defaultFileMode>
                                <fileMode>0644</fileMode>
                            </archiverConfig>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>prepare</id>
                        <phase>package</phase>
                        <configuration>
                            <skip>${docker.skip}</skip>
                            <target>
                                <echo message="prepare phase" />
                                <unzip src="${project.build.directory}/${project.artifactId}-${project.version}.zip" dest="${project.build.directory}/docker" />
                                <move file="${project.build.directory}/docker/${project.artifactId}-${project.version}" tofile="${project.build.directory}/docker/${project.artifactId}" />
                                <chmod file="${project.build.directory}/docker/${project.artifactId}/bin/*.sh" perm="+x" />
                                <chmod file="${project.build.directory}/docker/docker-entrypoint.sh" perm="+x" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>docker-entry-file</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <!-- # Filtered Resources -->
                                <resource>
                                    <directory>${basedir}/src/docker-distribution</directory>
                                    <filtering>true</filtering>
                                    <includes>
                                        <include>docker-entrypoint.sh</include>
                                    </includes>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}/docker</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-image-alpine</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <skipDocker>${docker.skip}</skipDocker>
                            <imageName>wso2/micro-integrator</imageName>
                            <imageTags>
                                <imageTag>${project.version}</imageTag>
                            </imageTags>
                            <dockerDirectory>${basedir}/src/docker-distribution/alpine</dockerDirectory>
                            <buildArgs>
                                <MICROESB_VERSION>${project.version}</MICROESB_VERSION>
                            </buildArgs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-image-centos</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <skipDocker>${docker.skip}</skipDocker>
                            <imageName>wso2/micro-integrator</imageName>
                            <imageTags>
                                <imageTag>${project.version}-centos7</imageTag>
                            </imageTags>
                            <dockerDirectory>${basedir}/src/docker-distribution/centos</dockerDirectory>
                            <buildArgs>
                                <MICROESB_VERSION>${project.version}</MICROESB_VERSION>
                            </buildArgs>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-image-ubuntu</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <skipDocker>${docker.skip}</skipDocker>
                            <imageName>wso2/micro-integrator</imageName>
                            <imageTags>
                                <imageTag>${project.version}-ubuntu18.04</imageTag>
                            </imageTags>
                            <dockerDirectory>${basedir}/src/docker-distribution/ubuntu</dockerDirectory>
                            <buildArgs>
                                <MICROESB_VERSION>${project.version}</MICROESB_VERSION>
                            </buildArgs>
                        </configuration>
                    </execution>
                    <!-- TODO Enable after configuring Jenkins to push docker -->
                    <!--<execution>-->
                        <!--<id>push-image</id>-->
                        <!--<phase>deploy</phase>-->
                        <!--<goals>-->
                            <!--<goal>push</goal>-->
                        <!--</goals>-->
                        <!--<configuration>-->
                            <!--<imageName>wso2/micro-integrator:${project.version}</imageName>-->
                        <!--</configuration>-->
                    <!--</execution>-->
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <docker.skip>true</docker.skip>
    </properties>

</project>
