<!--

     Copyright 2005-2015 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.66</version>
    </parent>

    <artifactId>fabric8mq</artifactId>
    <packaging>jar</packaging>

    <name>Fabric8 MQ :: Broker</name>
    <description>Fabric8 MQ Broker</description>

    <properties>
        <version.maven-surefire-plugin>2.15</version.maven-surefire-plugin>
        <guava.version>15.0</guava.version>

        <docker.port.container.amq>${activemq.container.port}</docker.port.container.amq>
        <docker.env.MAIN>io.fabric8.mq.Main</docker.env.MAIN>

        <fabric8.service.port>${activemq.container.port}</fabric8.service.port>
        <fabric8.service.containerPort>${activemq.container.port}</fabric8.service.containerPort>
        <fabric8.service.type>LoadBalancer</fabric8.service.type>

        <fabric8.label.component>fabric8MQ</fabric8.label.component>
        <fabric8.label.group>fabric8mq</fabric8.label.group>
        <fabric8.label.provider>fabric8</fabric8.label.provider>
        <fabric8.iconRef>icons/activemq.svg</fabric8.iconRef>

        <!-- add certs -->
        <fabric8.serviceAccount>fabric8</fabric8.serviceAccount>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-project</artifactId>
                <version>${fabric8.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>kubernetes-jolokia</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-mqtt</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-framework</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-recipes</artifactId>
        </dependency>

      <!-- TODO: remove version when upgrading to next fabric8 release -->
      <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-stomp</artifactId>
            <version>5.12.1</version>
        </dependency>

        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.4.7</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jettison</groupId>
            <artifactId>jettison</artifactId>
            <version>1.3.5</version>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-api</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.deltaspike.core</groupId>
            <artifactId>deltaspike-core-impl</artifactId>
        </dependency>

        <dependency>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric8-vertx</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-camel</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-broker</artifactId>
        </dependency>

        <!-- TODO: remove version when upgrading to next fabric8 release -->
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <version>3.1.2</version>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-json</artifactId>
            <version>3.1.2</version>
        </dependency>

        <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>

      <!-- TODO: remove version when upgrading to next fabric8 release -->
      <dependency>
            <groupId>org.apache.curator</groupId>
            <artifactId>curator-test</artifactId>
            <version>2.6.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.easyrules</groupId>
            <artifactId>easyrules-core</artifactId>
            <version>1.3.0</version>
        </dependency>

        <dependency>
            <groupId>org.easyrules</groupId>
            <artifactId>easyrules-jmx</artifactId>
            <version>1.3.0</version>
        </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.jolokia</groupId>
            <artifactId>jolokia-jvm</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-kahadb-store</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- TODO: upgrade to netty4 -->
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
            <version>3.9.9.Final</version>
        </dependency>
    </dependencies>


    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.maven-surefire-plugin}</version>
                <configuration>
                    <forkMode>perTest</forkMode>
                </configuration>
            </plugin>

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <version>2.10</version>
              <executions>
                <execution>
                  <id>add-classpath</id>
                  <phase>package</phase>
                  <goals>
                    <!--  create target/classpath for docker-maven-plugin's assembly to pick up  -->
                    <goal>build-classpath</goal>
                  </goals>
                  <configuration>
                    <prefix>.</prefix>
                    <pathSeparator>:</pathSeparator>
                    <includeScope>runtime</includeScope>
                    <outputFile>${project.build.directory}/classpath</outputFile>
                  </configuration>
                </execution>
              </executions>
            </plugin>

            <plugin>
                <groupId>org.jolokia</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker.maven.plugin.version}</version>
                <configuration>
                    <images>
                        <image>
                            <name>${docker.image}</name>
                            <build>
                                <from>${docker.from}</from>
                                <assembly>
                                  <basedir>/app</basedir>
                                  <descriptorRef>artifact-with-dependencies</descriptorRef>
                                </assembly>
                                <env>
                                    <AMQ_PORT>${activemq.container.port}</AMQ_PORT>
                                    <AMQ_DATA_DIRECTORY>/var/activemq</AMQ_DATA_DIRECTORY>
                                    <AMQ_BROKER_NAME>default</AMQ_BROKER_NAME>
                                    <JAVA_APP_JAR>${project.build.finalName}.jar</JAVA_APP_JAR>
                                    <JAVA_MAIN_CLASS>${docker.env.MAIN}</JAVA_MAIN_CLASS>
                                </env>
                                <ports>
                                    <port>${activemq.container.port}</port>
                                    <port>8778</port>
                                </ports>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${exec-maven-plugin.version}</version>
                <configuration>
                    <mainClass>io.fabric8.mq.Main</mainClass>
                    <includePluginDependencies>false</includePluginDependencies>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
