<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to Elasticsearch under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. Elasticsearch 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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>io.fabric8</groupId>
  <artifactId>elasticsearch-cloud-kubernetes</artifactId>
  <version>1.3.0</version>

  <name>Elasticsearch Kubernetes cloud plugin</name>
  <description>The Kubernetes Cloud plugin allows to use Kubernetes for the unicast discovery mechanism.</description>
  <url>https://github.com/jimmidyson/elasticsearch-cloud-kubernetes/</url>
  <inceptionYear>2013</inceptionYear>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>9</version>
  </parent>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <connection>scm:git:git@github.com:fabric8io/elasticsearch-cloud-kubernetes.git</connection>
    <developerConnection>scm:git:git@github.com:fabric8io/elasticsearch-cloud-kubernetes.git</developerConnection>
    <url>http://github.com/fabric8io/elasticsearch-cloud-kubernetes</url>
    <tag>elasticsearch-cloud-kubernetes-1.3.0</tag>
  </scm>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/fabric8io/elasticsearch-cloud-kubernetes/issues/</url>
  </issueManagement>

  <properties>
    <elasticsearch.version>1.6.0</elasticsearch.version>
    <fabric8.version>2.2.4</fabric8.version>
    <lucene.version>4.10.4</lucene.version>
    <tests.shuffle>true</tests.shuffle>
    <tests.output>onerror</tests.output>
    <tests.client.ratio />
    <es.plugin.port>9300</es.plugin.port>
    <es.logger.level>INFO</es.logger.level>
    <es.config>${project.build.testOutputDirectory}/elasticsearch.yml</es.config>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3.RC2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
      <version>1.3.RC2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.lucene</groupId>
      <artifactId>lucene-test-framework</artifactId>
      <version>${lucene.version}</version>
      <scope>test</scope>
    </dependency>

    <!-- Elasticsearch -->
    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>${elasticsearch.version}</version>
    </dependency>

    <!-- Fabric8 Kubernetes APIs -->
    <dependency>
      <groupId>io.fabric8</groupId>
      <artifactId>kubernetes-api</artifactId>
      <version>${fabric8.version}</version>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.7</version>
    </dependency>

    <!-- Tests -->
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.elasticsearch</groupId>
      <artifactId>elasticsearch</artifactId>
      <version>${elasticsearch.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <extensions>
      <extension>
        <groupId>org.kuali.maven.wagons</groupId>
        <artifactId>maven-s3-wagon</artifactId>
        <version>1.1.19</version>
      </extension>
    </extensions>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>plugin-test.properties</include>
          <include>elasticsearch.yml</include>
        </includes>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
        <includes>
          <include>log4j.xml</include>
        </includes>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.carrotsearch.randomizedtesting</groupId>
        <artifactId>junit4-maven-plugin</artifactId>
        <version>2.0.14</version>
        <executions>
          <execution>
            <id>tests</id>
            <phase>test</phase>
            <goals>
              <goal>junit4</goal>
            </goals>
            <configuration>
              <heartbeat>20</heartbeat>
              <jvmOutputAction>pipe,warn</jvmOutputAction>
              <leaveTemporary>true</leaveTemporary>
              <listeners>
                <report-ant-xml mavenExtensions="true" dir="${project.build.directory}/surefire-reports" />
                <report-text showThrowable="true" showStackTraces="true" showOutput="${tests.output}" showStatusOk="false" showStatusError="true" showStatusFailure="true" showStatusIgnored="true" showSuiteSummary="true" timestamps="false" />
                <report-execution-times file="${basedir}/.local-execution-hints.log" />
              </listeners>
              <assertions>
                <enable />
              </assertions>
              <parallelism>1</parallelism>
              <balancers>
                <execution-times>
                  <fileset dir="${basedir}" includes=".local-execution-hints.log" />
                </execution-times>
              </balancers>
              <includes>
                <include>**/*Tests.class</include>
                <include>**/*Test.class</include>
              </includes>
              <excludes>
                <exclude>**/Abstract*.class</exclude>
                <exclude>**/*StressTest.class</exclude>
              </excludes>
              <argLine>
                ${tests.jvm.argline}
              </argLine>
              <jvmArgs>
                <param>-Xmx512m</param>
                <param>-Xss256k</param>
                <param>-XX:MaxDirectMemorySize=512m</param>
                <param>-Des.logger.prefix=</param>
              </jvmArgs>
              <shuffleOnSlave>${tests.shuffle}</shuffleOnSlave>
              <sysouts>${tests.verbose}</sysouts>
              <seed>${tests.seed}</seed>
              <haltOnFailure>${tests.failfast}</haltOnFailure>
              <systemProperties>
                <!-- RandomizedTesting library system properties -->
                <tests.jvm.argline>${tests.jvm.argline}</tests.jvm.argline>
                <tests.iters>${tests.iters}</tests.iters>
                <tests.maxfailures>${tests.maxfailures}</tests.maxfailures>
                <tests.failfast>${tests.failfast}</tests.failfast>
                <tests.class>${tests.class}</tests.class>
                <tests.method>${tests.method}</tests.method>
                <tests.nightly>${tests.nightly}</tests.nightly>
                <tests.badapples>${tests.badapples}</tests.badapples>
                <tests.weekly>${tests.weekly}</tests.weekly>
                <tests.slow>${tests.slow}</tests.slow>
                <tests.k8s>${tests.k8s}</tests.k8s>
                <tests.config>${tests.config}</tests.config>
                <tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
                <tests.slow>${tests.slow}</tests.slow>
                <tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>
                <tests.showSuccess>${tests.showSuccess}</tests.showSuccess>
                <tests.integration>${tests.integration}</tests.integration>
                <tests.cluster_seed>${tests.cluster_seed}</tests.cluster_seed>
                <tests.client.ratio>${tests.client.ratio}</tests.client.ratio>
                <es.node.local>false</es.node.local>
                <es.node.mode>network</es.node.mode>
                <es.logger.level>${es.logger.level}</es.logger.level>
                <java.awt.headless>true</java.awt.headless>
              </systemProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.15</version>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.4</version>
        <configuration>
          <appendAssemblyId>false</appendAssemblyId>
          <outputDirectory>${project.build.directory}/releases/</outputDirectory>
          <descriptors>
            <descriptor>${basedir}/src/main/assemblies/plugin.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jolokia</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <version>0.12.0</version>
        <configuration>
          <images>
            <image>
              <name>docker.io/fabric8/elasticsearch-k8s:${elasticsearch.version}</name>
              <build>
                <from>elasticsearch:${elasticsearch.version}</from>
                <assembly>
                  <descriptor>${basedir}/src/main/assemblies/docker-image.xml</descriptor>
                  <basedir>/usr/share/elasticsearch/</basedir>
                </assembly>
                <env>
                  <NODE_DATA>true</NODE_DATA>
                  <NODE_MASTER>true</NODE_MASTER>
                </env>
              </build>
            </image>
          </images>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <releaseProfiles>docker-push</releaseProfiles>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>docker-push</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jolokia</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>build</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>exec</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
            <configuration>
              <executable>docker</executable>
              <arguments>
                <argument>push</argument>
                <argument>-f</argument>
                <argument>docker.io/fabric8/elasticsearch-k8s:${elasticsearch.version}</argument>
              </arguments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
