<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">
    <parent>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-functional-tests</artifactId>
        <version>8.7.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>jira-cache-check-tests</artifactId>
    <name>Atlassian JIRA - Testing - Cache Check Tests</name>

    <properties>
        <atlassian.cache.serialization.recording>${project.parent.parent.basedir}/serialrecord.dat</atlassian.cache.serialization.recording>
        <jira.alt.version>${project.version}</jira.alt.version>
        <jira.bundled.plugins.dir>${project.build.directory}/jira-bundled-plugins</jira.bundled.plugins.dir>
    </properties>

    <profiles>
        <profile>
            <id>jar-with-dependencies</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                        <executions>
                            <execution>
                                <id>build-jar-with-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>add-bundled-plugins</id>
            <build>
                <plugins>
                    <!--
                        All jira-bundled-plugins dependencies are required. Because of their provided scope, By adding the
                        jira-bundled-plugins dependency those dependencies won't be added. With the following 3 steps
                        all those plugins will be added to the classpath.
                    -->
                    <!-- This plugin writes all jira-bundled-plugins nested dependencies into "jira-bundled-plugins.txt"-->
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-bundled-plugins</artifactId>
                                    <version>${jira.alt.version}</version>
                                    <type>txt</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                    <destFileName>jira-bundled-plugins.txt</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                        <executions>
                            <execution>
                                <id>retrieve-bundle-plugins-definitions</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- This plugin downloads all the dependencies defined in jira-bundled-plugins.txt and copies to "${jira.bundled.plugins.dir}"-->
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>smartass-maven-plugin</artifactId>
                        <version>${smartass.version}</version>
                        <configuration>
                            <sourceList>${project.build.directory}/jira-bundled-plugins.txt</sourceList>
                            <targetDirectory>${jira.bundled.plugins.dir}</targetDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>download-bundled-plugins-artifacts</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy-listed-artifacts</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- This plugin adds "${jira.bundled.plugins.dir}" to the classpath-->
                    <plugin>
                        <groupId>com.googlecode.addjars-maven-plugin</groupId>
                        <artifactId>addjars-maven-plugin</artifactId>
                        <version>1.0.5</version>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${jira.bundled.plugins.dir}</directory>
                                </resource>
                            </resources>
                        </configuration>
                        <executions>
                            <execution>
                                <id>add-bundled-plugins-to-classpath</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>add-jars</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.jira</groupId>
                    <artifactId>jira-bundled-plugins</artifactId>
                    <version>${jira.alt.version}</version>
                    <type>pom</type>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>${maven.test.unit.skip}</skip>
                    <systemPropertyVariables>
                        <atlassian.cache.serialization.recording>${atlassian.cache.serialization.recording}</atlassian.cache.serialization.recording>
                    </systemPropertyVariables>
                </configuration>
                <executions>
                    <!-- Move default surefire execution to integration-test phase -->
                    <execution>
                        <id>default-test</id>
                        <phase>integration-test</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-core</artifactId>
            <version>${jira.alt.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-client</artifactId>
            <version>${analytics.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-tests</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
