<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.atlassian.confluence.plugins</groupId>
        <artifactId>confluence-auditing-coverage-parent</artifactId>
        <version>20.2.11</version>
    </parent>

    <artifactId>confluence-auditing-coverage</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Confluence Auditing coverage plugin</name>
    <description>This plugin contains listeners, which handle different events, and create appropriate auditing entities, to enhance coverage</description>

    <properties>
        <skipJacocoReport>false</skipJacocoReport>
        <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <sonar.sources>src/main</sonar.sources>
        <sonar.tests>src/test</sonar.tests>
        <test-coverage.integration-test-directory>${project.basedir}/../confluence-auditing-coverage-integration-tests</test-coverage.integration-test-directory>
        <test-coverage.skip-copy-integration-test-report>false</test-coverage.skip-copy-integration-test-report>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>provided</scope>
        </dependency>
        <!--  *********************  -->
        <!--    Sources of events    -->
        <!--  *********************  -->
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>synchrony-interop</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-mobile-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-nav-links-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth</groupId>
            <artifactId>atlassian-oauth-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth</groupId>
            <artifactId>atlassian-oauth-service-provider-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.user</groupId>
            <artifactId>atlassian-user</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- Test dependencies  -->
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <configuration combine.children="append">
                    <includeExclude />
                    <scannedDependencies>
                        <dependency>
                            <groupId>com.atlassian.plugin</groupId>
                            <artifactId>atlassian-spring-scanner-external-jar</artifactId>
                        </dependency>
                    </scannedDependencies>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>confluence-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Atlassian-Plugin-Key>${project.groupId}.${project.artifactId}</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <Import-Package>com.atlassian.audit.api,
                            com.atlassian.audit.entity,
                            com.atlassian.confluence.plugins.mobile.analytic;resolution:=optional,
                            com.atlassian.confluence.plugins.synchrony.api.events;resolution:=optional,
                            com.atlassian.confluence.user;resolution:=optional,
                            com.atlassian.confluence.audit;resolution:=optional,
                            com.atlassian.confluence.util;resolution:=optional,
                            com.atlassian.event.api,
                            com.atlassian.plugin.spring.scanner.annotation.imports,
                            com.atlassian.plugins.whitelist;resolution:=optional,
                            com.atlassian.plugins.whitelist.events;resolution:=optional,
                            com.atlassian.plugins.custom_apps.api;resolution:=optional,
                            com.atlassian.plugins.custom_apps.api.events;resolution:=optional,
                            com.atlassian.plugins.navlink.producer.navigation;resolution:=optional,
                            com.atlassian.plugins.navlink.producer.navigation.links;resolution:=optional,
                            com.atlassian.confluence.event.events.search.*;resolution:=optional,
                            com.atlassian.oauth.*;resolution:=optional,
                            com.atlassian.applinks.*;resolution:=optional,
                            com.atlassian.user.*,
                            com.atlassian.scheduler.*,
                            com.atlassian.sal.api,
                            com.atlassian.sal.api.message,
                            com.atlassian.sal.api.user,
                            com.google.common.collect,
                            org.joda.time,
                            org.slf4j,
                            org.springframework.beans.factory,
                            org.springframework.beans.factory.annotation,
                            org.springframework.stereotype</Import-Package>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>sonar-ut</id>
            <properties>
                <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco-unit/${jacoco.report.name}</sonar.coverage.jacoco.xmlReportPaths>
            </properties>
        </profile>
        <profile>
            <id>sonar-it</id>
            <properties>
                <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco-integration/${jacoco.report.name}</sonar.coverage.jacoco.xmlReportPaths>
            </properties>
        </profile>
    </profiles>
</project>
