<!--

     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.jube.images.fabric8</groupId>
        <artifactId>apps</artifactId>
        <version>2.2.12</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.service.port}</fabric8.service.port>
        <fabric8.service.containerPort>${activemq.container.port}</fabric8.service.containerPort>

        <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>
        <fabric8.volume.openshift-cert-secrets.secret>openshift-cert-secrets</fabric8.volume.openshift-cert-secrets.secret>
        <fabric8.volume.openshift-cert-secrets.mountPath>/etc/secret-volume</fabric8.volume.openshift-cert-secrets.mountPath>
        <fabric8.volume.openshift-cert-secrets.readOnly>true</fabric8.volume.openshift-cert-secrets.readOnly>
    </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>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-stomp</artifactId>
            <version>5.11.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>gateway-core</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>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-core</artifactId>
            <version>3.1.1</version>
        </dependency>
        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-json</artifactId>
            <version>3.1.0</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>

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

    </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.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>
                                    <descriptorRef>${docker.assemblyDescriptorRef}</descriptorRef>
                                </assembly>
                                <env>
                                    <MAIN>${docker.env.MAIN}</MAIN>
                                    <AMQ_PORT>${activemq.container.port}</AMQ_PORT>
                                    <AMQ_DATA_DIRECTORY>/var/activemq</AMQ_DATA_DIRECTORY>
                                    <AMQ_BROKER_NAME>default</AMQ_BROKER_NAME>
                                </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>

    <profiles>
        <profile>
            <id>jube</id>
            <activation>
                <property>
                    <name>jube.plugin.enabled</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8.jube</groupId>
                        <artifactId>jube-maven-plugin</artifactId>
                        <version>${jube.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>docker-build</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jolokia</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>${docker.maven.plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>docker-push</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jolokia</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>${docker.maven.plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>build</goal>
                                    <goal>push</goal>
                                </goals>
                                <phase>package</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
