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

     Copyright 2005-2016 Red Hat, Inc.

     Red Hat 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">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.fabric8.ipaas.apps</groupId>
    <artifactId>fabric8-ipaas</artifactId>
    <version>2.2.168</version>
  </parent>

  <artifactId>message-broker</artifactId>
  <packaging>jar</packaging>

  <name>Message Broker</name>
  <description>Enterprise Message Broker based on Apache ActiveMQ Artemis</description>

  <properties>
    <version.maven-surefire-plugin>2.15</version.maven-surefire-plugin>
    <guava.version>15.0</guava.version>
    <artemis.version>1.2.0</artemis.version>
    <spring-boot.version>1.3.7.RELEASE</spring-boot.version>
    <hibernate-version>4.1.0.Final</hibernate-version>
    <geronimo.jms.2.spec.version>1.0-alpha-2</geronimo.jms.2.spec.version>
    <docker.image>${fabric8.dockerUser}${project.artifactId}:${project.version}</docker.image>

  </properties>

  <dependencyManagement>
    <dependencies>
      <!-- import fabric8 platfrom bom first -->
      <dependency>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-project-bom-with-platform-deps</artifactId>
        <version>${fabric8.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter</artifactId>
      <exclusions>
        <!-- Clashes with fabric8 logging -->
        <exclusion>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator-annotation-processor</artifactId>
      <version>${hibernate-version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-jms-client</artifactId>
      <version>${artemis.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-selector</artifactId>
      <version>${artemis.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-journal</artifactId>
      <version>${artemis.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-core-client</artifactId>
      <version>${artemis.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-server</artifactId>
      <version>${artemis.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-openwire-protocol</artifactId>
      <version>${artemis.version}</version>
    </dependency>

    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-amqp-protocol</artifactId>
      <version>${artemis.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-hornetq-protocol</artifactId>
      <version>${artemis.version}</version>
    </dependency>
<!--
    TODO disabled as it brings in different version of netty

    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-mqtt-protocol</artifactId>
      <version>${artemis.version}</version>
    </dependency>
-->
    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>artemis-jms-server</artifactId>
      <version>${artemis.version}</version>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <!-- Note: need to override guava version as leveldb has an issue with > 15.0 -->
      <version>${guava.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-utils</artifactId>
    </dependency>

    <!-- testing -->
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>fabric8-arquillian</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>kubernetes-assertions</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.arquillian.container</groupId>
      <artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
      <version>1.0.0.CR8</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>io.fabric8</groupId>
        <artifactId>fabric8-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>fmp</id>
            <goals>
              <goal>resource</goal>
              <goal>helm</goal>
              <goal>build</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <images>
            <image>
              <name>${docker.image}</name>
              <build>
                <from>${docker.from}</from>
                <assembly>
                  <basedir>/app</basedir>
                  <descriptorRef>artifact</descriptorRef>
                </assembly>
                <env>
                  <AB_JOLOKIA_AUTH_OPENSHIFT>true</AB_JOLOKIA_AUTH_OPENSHIFT>
                  <JAVA_APP_JAR>${project.build.finalName}.jar</JAVA_APP_JAR>
                </env>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>
      <!-- Compiler plugin enforces Java 1.8 compatibility and activates annotation processors -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.18.1</version>
        <inherited>true</inherited>
        <configuration>
          <argLine>-Djava.security.egd=file:/dev/./urandom</argLine>
          <excludes>
            <exclude>**/*KT.java</exclude>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring-boot.version}</version>
        <configuration>
          <mainClass>io.fabric8.msg.artemis.Artemis</mainClass>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <!--
  Default sample commands:

  mvn -Pf8-build         ... build Docker images and create OpenShift deployment configs
  mvn -Pf8-deploy        ... f8-build + push to Docker registry + applying deployment config to OpenShift
  mvn -Pf8-local-deploy ... deployment for a single node setup without pushing to a registry

  For individual goal usage please consult the fabric8 documentation
  -->
  <profiles>
    <profile>
      <id>f8-build</id>
      <build>
        <defaultGoal>clean install docker:build fabric8:json</defaultGoal>
      </build>
    </profile>
    <profile>
      <id>f8-deploy</id>
      <properties>
        <fabric8.imagePullPolicySnapshot>Always</fabric8.imagePullPolicySnapshot>
        <fabric8.recreate>true</fabric8.recreate>
      </properties>
      <build>
        <defaultGoal>clean install docker:build docker:push fabric8:json fabric8:apply</defaultGoal>
      </build>
    </profile>
    <profile>
      <id>f8-local-deploy</id>
      <properties>
        <fabric8.recreate>true</fabric8.recreate>
      </properties>
      <build>
        <defaultGoal>clean install docker:build fabric8:json fabric8:apply</defaultGoal>
      </build>
    </profile>
  </profiles>

</project>