<?xml version="1.0" encoding="UTF-8"?>
<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>com.atlassian.pom</groupId>
        <artifactId>public-pom</artifactId>
        <version>3.0.100</version>
    </parent>

    <groupId>com.atlassian.elasticsearch</groupId>
    <artifactId>buckler-plugin</artifactId>
    <version>0.2.8</version>

    <name>elasticsearch-buckler-plugin</name>
    <description>The Buckler Plugin for Elasticsearch provides authentication and transport security.</description>

    <packaging>jar</packaging>

    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <properties>
        <elasticsearch.version>2.3.3</elasticsearch.version>
        <!-- This should correspond to the version in the org.elasticsearch:parent pom -->
        <securemock.version>1.1</securemock.version>
        <jdkLevel>1.7</jdkLevel>
        <maven.compiler.source>${jdkLevel}</maven.compiler.source>
        <maven.compiler.target>${jdkLevel}</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <descriptor.main>
### Plugin Descriptor
#
# See https://www.elastic.co/guide/en/elasticsearch/plugins/current/plugin-authors.html

### Mandatory elements for all plugins:
description=${project.description}
version=${project.version}
name=buckler

### JVM plugin elements:

# true if the classname class should be loaded from jar files in the root directory of the plugin.
# Note that only jar files in the root directory are added to the classpath for the plugin!
# If you need other resources, package them into a resources jar.
jvm=true

# FQN
classname=com.atlassian.elasticsearch.buckler.BucklerPlugin

# Version of java the code is built against.
# Version string must be a sequence of nonnegative decimal integers separated by "."'s and may have leading zeros.
java.version=${maven.compiler.target}

# 'elasticsearch.version' version of elasticsearch compiled against
# You will have to release a new version of the plugin for each new
# elasticsearch release. This version is checked when the plugin
# is loaded so Elasticsearch will refuse to start in the presence of
# plugins with the incorrect elasticsearch.version.
        </descriptor.main>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
        <!-- securemock wraps Mockito to make it work with the security manager that Elasticsearch uses -->
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>securemock</artifactId>
            <version>${securemock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.carrotsearch.randomizedtesting</groupId>
            <artifactId>randomizedtesting-runner</artifactId>
            <!-- This should correspond to the version in the org.elasticsearch:parent pom -->
            <version>2.3.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-test-framework</artifactId>
            <!-- This should correspond to the version in the org.elasticsearch:parent pom -->
            <version>5.5.0</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>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk15on</artifactId>
            <version>1.52</version>
            <scope>test</scope>
        </dependency>

        <!-- lucene-test-framework requires that it comes before lucene-core in the classpath :( -->
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
            <version>${elasticsearch.version}</version>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty</artifactId>
            <!-- This should correspond to the version in the org.elasticsearch:parent pom -->
            <version>3.10.5.Final</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>233</id>
            <activation><activeByDefault>true</activeByDefault></activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.6</version>
                        <executions>
                            <execution>
                                <id>pack-233</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>

                                <configuration>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                                    <descriptors>
                                        <descriptor>${basedir}/src/main/assemblies/plugin/plugin-2.3.3.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>232</id>
            <activation><activeByDefault>true</activeByDefault></activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.6</version>
                        <executions>
                            <execution>
                                <id>pack-232</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                                    <descriptors>
                                        <descriptor>${basedir}/src/main/assemblies/plugin/plugin-2.3.2.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>231</id>
            <activation><activeByDefault>true</activeByDefault></activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.6</version>
                        <executions>
                            <execution>
                                <id>pack-231</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <appendAssemblyId>true</appendAssemblyId>
                                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                                    <descriptors>
                                        <descriptor>${basedir}/src/main/assemblies/plugin/plugin-2.3.1.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <version>2.0</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                nexusBaseUrl = "https://maven.atlassian.com/content/groups/public"
                                artifactPath = "${project.groupId}.${project.artifactId}".replaceAll("\\.", "/")
                                nexusZipUrl = "$nexusBaseUrl/$artifactPath/${project.version}/${project.build.finalName}.zip"
                                goZipLinkName = "buckler-for-elasticsearch-${elasticsearch.version}"

                                goBaseUrl = "http://go.atlassian.com/admin.py?action=SAVE&amp;is_public=on"
                                goZipUrl = "$goBaseUrl&amp;path=$goZipLinkName&amp;url=$nexusZipUrl"
                                goShaUrl = "$goBaseUrl&amp;path=${goZipLinkName}.sha1&amp;url=${nexusZipUrl}.sha1"

                                log.info('\nPlease register the release using following links:\n - {}\n - {}', goZipUrl, goShaUrl)
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>pack-plugin-sources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>true</appendAssemblyId>
                            <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                            <descriptors>
                                <descriptor>${basedir}/src/main/assemblies/plugin-sources.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <scm>
        <tag>buckler-plugin-2.3.3-0.2.6</tag>
    </scm>
</project>
