<?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>7.0.6</version>
    </parent>

    <groupId>com.atlassian.confluence.plugins.toc</groupId>
    <artifactId>toc-plugin-project</artifactId>
    <version>9.1.3</version>
    <packaging>pom</packaging>

    <name>Table of Contents Plugin Project</name>
    <description>This Confluence plugin generates a Table of Contents for the current page based on its headings.</description>

    <modules>
        <module>plugin</module>
        <module>integration-tests</module>
    </modules>

    <scm>
        <connection>scm:git:ssh://git@bitbucket.org/atlassian/confluence-toc-plugin.git</connection>
        <developerConnection>scm:git:ssh://git@bitbucket.org/atlassian/confluence-toc-plugin.git</developerConnection>
        <url>https://bitbucket.org/atlassian/confluence-toc-plugin</url>
        <tag>toc-plugin-project-9.1.3</tag>
    </scm>

    <issueManagement>
        <system>Jira</system>
        <url>https://ecosystem.atlassian.net/browse/TOC</url>
    </issueManagement>

    <ciManagement>
        <system>Bamboo</system>
        <url>https://server-syd-bamboo.internal.atlassian.com/browse/CBP-TOC</url>
    </ciManagement>

    <properties>
        <!--  This has to stay as a randombits key because toc was bundled with Conf 2.3 using that key -->
        <atlassian.plugin.key>org.randombits.confluence.toc</atlassian.plugin.key>
        <confluence.version>10.1.1-CONFSRVDEV-48239-m03</confluence.version>
        <confluence.data.version>${confluence.version}</confluence.data.version>
        <failOnMilestoneOrReleaseCandidateDeps>false</failOnMilestoneOrReleaseCandidateDeps>
        <atlassian.product.test-lib.version>2.13.4</atlassian.product.test-lib.version>
        <plexus-utils.version>3.0.24</plexus-utils.version>
        <amps8.version>9.3.2</amps8.version>
        <containerId>tomcat10x</containerId>
        <atlassian.dev.mode>false</atlassian.dev.mode>
        <jvm.args.custom /> <!-- Allows to specify custom arguments in build scripts -->
        <jvm.args.xmx>1024m</jvm.args.xmx>
        <jvm.args>-Xmx${jvm.args.xmx} ${jvm.args.custom}</jvm.args>

        <webdriver.browser>firefox</webdriver.browser>

        <!-- For the flaky test reporter profile. -->
        <!-- override the versions of the listed plugins in amps -->
        <version.override.set>maven-failsafe-plugin</version.override.set>
        <!-- failsafe 2.20.1 or newer required for rerun support. Double check the version from the parent-pom -->
        <surefire.version>3.0.0</surefire.version>
        <flaky.test.reporter.version>4.0.11</flaky.test.reporter.version>
        <download.maven.plugin.version>1.6.8</download.maven.plugin.version>
        <junit.version>5.9.2</junit.version>

        <!-- SonarQube properties (these are inherited for each module) -->
        <sonar.projectName>Confluence DC Table of Content</sonar.projectName>
        <sonar.links.issue>${project.issueManagement.url}</sonar.links.issue>
        <sonar.links.ci>${project.ciManagement.url}</sonar.links.ci>
        <sonar.projectKey>confluence-dc-table-of-content</sonar.projectKey>
        <!-- For multiple modules -->
        <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
        <sonar.tests>src/test</sonar.tests>

        <jacocoItDestinationFile>${project.build.directory}/jacoco-it.exec</jacocoItDestinationFile>
        <skipJacocoReport>true</skipJacocoReport>
        <jacoco.report.name>jacoco.xml</jacoco.report.name>

        <neko-htmlunit-version>4.6.0</neko-htmlunit-version>
        <atlassian-antisamy-support-version>1.0.3</atlassian-antisamy-support-version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.confluence</groupId>
                <artifactId>confluence-plugins-platform-pom</artifactId>
                <version>${confluence.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.htmlunit</groupId>
                <artifactId>neko-htmlunit</artifactId>
                <version>${neko-htmlunit-version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.confluence</groupId>
                <artifactId>atlassian-antisamy-support</artifactId>
                <version>${atlassian-antisamy-support-version}</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>confluence-maven-plugin</artifactId>
                    <version>${amps8.version}</version>
                </plugin>
                <plugin>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>amps-maven-plugin</artifactId>
                    <version>${amps8.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.junit.jupiter</groupId>
                            <artifactId>junit-jupiter-engine</artifactId>
                            <version>${junit.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.junit.vintage</groupId>
                            <artifactId>junit-vintage-engine</artifactId>
                            <version>${junit.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${surefire.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>parse-jacoco-it-report</id>
                        <phase>none</phase>
                        <goals>
                            <goal>report-integration</goal>
                        </goals>
                        <configuration>
                            <skip>${skipJacocoReport}</skip>
                            <includes>
                                <include>net/customware/confluence/**</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>parse-jacoco-aggregated-report</id>
                        <phase>none</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                        <configuration>
                            <skip>${skipJacocoReport}</skip>
                            <!-- as we are going to run in only for the plugin, then we have to include the current project -->
                            <includeCurrentProject>true</includeCurrentProject>
                            <includes>
                                <include>net/customware/confluence/**</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>
    <profiles>
        <profile>
            <id>jacoco</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.atlassian.drs</groupId>
                        <artifactId>dependency-report-maven-plugin</artifactId>
                        <version>2.0.9</version>
                        <configuration>
                            <projectId>d1562453-ae99-4f8f-8e22-9d220f7bcb07</projectId>
                            <gracefulFailure>true</gracefulFailure>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>upload</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <!-- Code coverage -->
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>agent-for-ut</id>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                                <configuration>
                                    <propertyName>jacoco.agent.argLine</propertyName>
                                    <includes>
                                        <include>net/customware/confluence/**</include>
                                    </includes>
                                </configuration>
                            </execution>
                            <execution>
                                <id>agent-for-it</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>prepare-agent-integration</goal>
                                </goals>
                                <configuration>
                                    <propertyName>jacoco.agent.it.argLine</propertyName>
                                    <includes>
                                        <include>net/customware/confluence/**</include>
                                    </includes>
                                    <destFile>${jacocoItDestinationFile}</destFile>
                                </configuration>
                            </execution>
                            <execution>
                                <id>parse-jacoco-ut-report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>@{jacoco.agent.argLine}</argLine>
                            <!-- Ignoring integration tests on test phase so they just run in integration-test phase.-->
                            <!-- This configuration is necessary when using AMPS together with a parent POM.-->
                            <excludes>
                                <exclude>it/**</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
