<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates.
~
~ 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>org.guvnor</groupId>
    <artifactId>guvnor-ala</artifactId>
    <version>7.2.0.Final</version>
  </parent>
  <artifactId>guvnor-ala-distribution</artifactId>
  <packaging>war</packaging>
  <name>Guvnor ALA :: Distribution (Swarm/Docker)</name>
  <properties>
    <endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
  </properties>
  <dependencies>
    <!-- Swarm Fractions -->
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>cdi</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.glassfish</groupId>
          <artifactId>javax.el-impl</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.inject</groupId>
          <artifactId>javax.inject</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>container</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.wildfly.swarm</groupId>
          <artifactId>bootstrap</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.ow2.asm</groupId>
          <artifactId>asm-all</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>jaxrs</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.ow2.asm</groupId>
          <artifactId>asm-all</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.wildfly.swarm</groupId>
      <artifactId>jaxrs-cdi</artifactId>
    </dependency>

    <!-- GUVNOR ALA Dependencies -->
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-spi</artifactId>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-services-api</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax</groupId>
          <artifactId>javaee-web-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.spec.javax.ws.rs</groupId>
          <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.ws.rs</groupId>
          <artifactId>javax.ws.rs-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.inject</groupId>
          <artifactId>javax.inject</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-source-git</artifactId>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-services-rest</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax</groupId>
          <artifactId>javaee-web-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.jboss.spec.javax.ws.rs</groupId>
          <artifactId>jboss-jaxrs-api_2.0_spec</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.ws.rs</groupId>
          <artifactId>javax.ws.rs-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-build-maven</artifactId>
      <exclusions>
        <exclusion>
          <groupId>aopalliance</groupId>
          <artifactId>aopalliance</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-docker-provider</artifactId>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-openshift-provider</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-ala-wildfly-provider</artifactId>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-client</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson2-provider</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap.resolver</groupId>
      <artifactId>shrinkwrap-resolver-impl-maven</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.wildfly.swarm</groupId>
        <artifactId>wildfly-swarm-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>package</goal>
            </goals>
          </execution>
          <execution>
            <id>start</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
            </goals>
          </execution>
          <execution>
            <id>stop</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.15.0</version>
        <configuration>
          <images>
            <image>
              <name>guvnor/guvnor-ala-services</name>
              <build>
                <from>jboss/base-jdk:8</from>
                <maintainer>admin@kiegroup.com</maintainer>
                <ports>
                  <port>8082</port>
                </ports>
                <volumes>
                  <volume>/deploy/</volume>
                </volumes>
                <entryPoint>
                  <exec>
                    <arg>java</arg>
                    <arg>-jar</arg>
                    <arg>/opt/wildfly-swarm/guvnor-ala-services.jar</arg>
                  </exec>
                </entryPoint>
                <assembly>
                  <inline>
                    <dependencySets>
                      <dependencySet>
                        <useProjectAttachments>true</useProjectAttachments>
                        <includes>
                          <include>org.guvnor:guvnor-ala-services-swarm:jar:swarm</include>
                        </includes>
                        <outputFileNameMapping>guvnor-ala-services.jar</outputFileNameMapping>
                      </dependencySet>
                    </dependencySets>
                    <fileSets>
                      <fileSet>
                        <directory>${project.basedir}/src/main/docker</directory>
                        <outputDirectory>/</outputDirectory>
                        <includes>
                          <include>settings.xml</include>
                        </includes>
                        <fileMode>755</fileMode>
                      </fileSet>
                    </fileSets>
                  </inline>
                  <user>jboss:jboss:jboss</user>
                  <basedir>/opt/wildfly-swarm</basedir>
                </assembly>
              </build>
              <run>
                <ports>
                  <port>8082</port>
                </ports>
              </run>
            </image>
          </images>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>skipTests</id>
      <activation>
        <property>
          <name>skipTests</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>wildfly-swarm-plugin</artifactId>
            <executions>
              <!-- No need to start the Swarm jar in case the tests are skipped. -->
              <execution>
                <id>start</id>
                <phase>none</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop</id>
                <phase>none</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
