<?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>
        <artifactId>plugins</artifactId>
        <groupId>com.atlassian.bitbucket.search</groupId>
        <version>4.4.3</version>
    </parent>

    <!-- NOTE: This groupId and artifactID is fixed because AMPS contains "embedded-elasticsearch-plugin" as a hard-coded string-->
    <!-- See https://bitbucket.org/atlassian/amps/src/f38e44eceeb03ed65a1497c061077631826c05eb/maven-amps-plugin/src/main/java/com/atlassian/maven/plugins/amps/product/BitbucketProductHandler.java?at=master&fileviewer=file-view-default#BitbucketProductHandler.java-74-->
    <artifactId>embedded-elasticsearch-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>
    <name>Bitbucket Search - Embedded Elasticsearch plugin</name>
    <description>Plugin that starts an embedded Elasticsearch node to be used for development purposes only (e.g. in AMPS)</description>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.bitbucket.search</groupId>
                <artifactId>bitbucket-search-parent</artifactId>
                <version>${project.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.elasticsearch</groupId>
            <artifactId>elasticsearch</artifactId>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!--Test dependencies-->
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-it-common</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.search</groupId>
            <artifactId>test-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- There are no unit tests below this module, only integration tests. Surefire is used to run
                         the unit tests, and Failsafe is used to run the integration tests. So we can fully disable
                         the Surefire plugin below here; it's not necessary. -->
                    <excludes>
                        <exclude>it/**/*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <skipITs>${skipIntegrationTests}</skipITs>
                    <skipTests>${skipIntegrationTests}</skipTests>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>bitbucket-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <skipITs>${skipIntegrationTests}</skipITs>
                    <skipTests>${skipIntegrationTests}</skipTests>
                    <extractDependencies>false</extractDependencies>
                    <products>
                        <product>
                            <id>bitbucket</id>
                            <instanceId>bitbucket</instanceId>
                            <version>${bitbucket.version}</version>
                            <dataVersion>${bitbucket.version}</dataVersion>
                        </product>
                    </products>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
                        <Private-Package>
                            com.atlassian.bitbucket.search.internal*
                        </Private-Package>
                        <Export-Package>
                            com.atlassian.bitbucket.search.elasticsearch.embedded
                        </Export-Package>
                        <Spring-Context>*</Spring-Context>
                        <Import-Package>
                            com.atlassian.bitbucket.server,
                            org.slf4j.*,
                            org.springframework.beans.factory,
                            com.atlassian.*,
                            javax.*
                        </Import-Package>
                    </instructions>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.bitbucket.search</groupId>
                            <artifactId>bitbucket-search-common</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.bitbucket.search</groupId>
                            <artifactId>bitbucket-search-index</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
