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

    Copyright 2015 Red Hat, Inc. and/or its affiliates
    and other contributors as indicated by the @author tags.

    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.hawkular.accounts</groupId>
    <artifactId>hawkular-accounts-parent</artifactId>
    <version>2.0.2.Final</version>
  </parent>

  <name>Hawkular - Accounts - Distribution</name>
  <artifactId>hawkular-accounts-distribution</artifactId>
  <packaging>pom</packaging>

  <description>
    Builds a distribution package on top of Wildfly with a Keycloak server.
  </description>

  <dependencies>
    <dependency>
      <groupId>org.hawkular.accounts</groupId>
      <artifactId>hawkular-accounts</artifactId>
      <version>2.0.2.Final</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.hawkular.accounts</groupId>
      <artifactId>hawkular-accounts-events-backend</artifactId>
      <version>2.0.2.Final</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.hawkular.accounts</groupId>
      <artifactId>hawkular-accounts-secret-store</artifactId>
      <version>2.0.2.Final</version>
      <type>war</type>
    </dependency>
    <dependency>
      <groupId>org.hawkular.accounts</groupId>
      <artifactId>hawkular-accounts-keycloak-theme</artifactId>
      <version>2.0.2.Final</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>org.hawkular.accounts</groupId>
      <artifactId>hawkular-accounts-keycloak-event-listener-rest</artifactId>
      <version>2.0.2.Final</version>
      <classifier>module</classifier>
      <type>zip</type>
    </dependency>
    <dependency>
      <groupId>org.hawkular.accounts</groupId>
      <artifactId>hawkular-accounts-keycloak-event-listener-jms</artifactId>
      <version>2.0.2.Final</version>
      <classifier>module</classifier>
      <type>zip</type>
    </dependency>
    <dependency>
      <groupId>org.hawkular.commons</groupId>
      <artifactId>hawkular-commons-embedded-cassandra-ear</artifactId>
      <type>ear</type>
    </dependency>
    <dependency>
      <groupId>org.keycloak</groupId>
      <artifactId>keycloak-wf9-modules</artifactId>
      <version>${version.org.keycloak}</version>
      <type>zip</type>
    </dependency>
    <dependency>
      <groupId>com.datastax.cassandra</groupId>
      <artifactId>cassandra-driver-core</artifactId>
      <exclusions>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-handler</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.netty</groupId>
          <artifactId>netty-transport-native-epoll</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.wildfly</groupId>
                  <artifactId>wildfly-dist</artifactId>
                  <type>zip</type>
                  <version>${version.org.wildfly}</version>
                  <outputDirectory>${project.build.directory}/unpacked</outputDirectory>
                </artifactItem>
                <artifactItem>
                  <groupId>org.keycloak</groupId>
                  <artifactId>keycloak-server-overlay</artifactId>
                  <type>zip</type>
                  <version>${version.org.keycloak}</version>
                  <outputDirectory>${project.build.directory}/keycloak</outputDirectory>
                </artifactItem>
                <artifactItem>
                  <groupId>org.keycloak</groupId>
                  <artifactId>keycloak-wf9-modules</artifactId>
                  <version>${version.org.keycloak}</version>
                  <type>zip</type>
                  <outputDirectory>${project.build.directory}/keycloak/modules/system/layers/base</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <version>1.0</version>
        <executions>
          <execution>
            <id>generate-resources</id>
            <phase>package</phase>
            <goals>
              <goal>transform</goal>
            </goals>
            <configuration>
              <transformationSets>
                <transformationSet>
                  <dir>${project.build.directory}/unpacked/wildfly-${version.org.wildfly}/standalone/configuration</dir>
                  <stylesheet>src/main/xslt/standalone.xsl</stylesheet>
                  <includes>
                    <include>standalone*.xml</include>
                  </includes>
                  <outputDir>${project.build.directory}/unpacked/wildfly-${version.org.wildfly}/standalone/configuration</outputDir>
                  <parameters>
                    <parameter>
                      <name>uuid.hawkular.accounts.backend</name>
                      <value>${uuid.hawkular.accounts.backend}</value>
                    </parameter>
                    <parameter>
                      <name>uuid.hawkular.ui</name>
                      <value>${uuid.hawkular.ui}</value>
                    </parameter>
                  </parameters>
                </transformationSet>
              </transformationSets>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>distribution</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>assembly.xml</descriptor>
              </descriptors>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>

