<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.atlassian.webhooks</groupId>
        <artifactId>atlassian-webhooks-parent</artifactId>
        <version>8.1.6</version>
    </parent>

    <artifactId>atlassian-webhooks-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian Webhooks Plugin</name>
    <description>Plugin that provides webhooks capability</description>

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

    <dependencies>
        <dependency>
            <groupId>com.atlassian.webhooks</groupId>
            <artifactId>atlassian-webhooks-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.webhooks</groupId>
            <artifactId>atlassian-webhooks-spi</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.webhooks</groupId>
            <artifactId>atlassian-webhooks-data-migration</artifactId>
        </dependency>

        <dependency>
            <groupId>com.atlassian.httpclient</groupId>
            <artifactId>atlassian-httpclient-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.httpclient</groupId>
            <artifactId>atlassian-httpclient-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.fugue</groupId>
            <artifactId>fugue</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.atlassian.util.concurrent</groupId>
            <artifactId>atlassian-util-concurrent</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.event</groupId>
            <artifactId>atlassian-event</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</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>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Spring Java configuration dependencies-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
        </dependency>

        <dependency>
            <groupId>com.atlassian.profiling</groupId>
            <artifactId>atlassian-profiling</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
            <version>3.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</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>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-nop</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.7.0</version> <!-- TODO remove !-->
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.200</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.5.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>mysql</id>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                </dependency>
            </dependencies>
            <properties>
                <jdbc.port>3306</jdbc.port>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <jdbc.url>jdbc:mysql://${jdbc.host}:${jdbc.port}/${jdbc.database}</jdbc.url>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>postgres</id>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                </dependency>
            </dependencies>
            <properties>
                <jdbc.port>5432</jdbc.port>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <jdbc.url>jdbc:postgresql://${jdbc.host}:${jdbc.port}/${jdbc.database}</jdbc.url>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>oracle</id>
            <dependencies>
                <dependency>
                    <groupId>com.oracle.jdbc</groupId>
                    <artifactId>ojdbc8</artifactId>
                </dependency>
            </dependencies>
            <properties>
                <jdbc.port>1521</jdbc.port>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <jdbc.url>jdbc:oracle:thin:@${jdbc.host}:${jdbc.port}:${jdbc.database}</jdbc.url>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>mssql</id>
            <dependencies>
                <dependency>
                    <groupId>com.microsoft.sqlserver</groupId>
                    <artifactId>mssql-jdbc</artifactId>
                </dependency>
            </dependencies>
            <properties>
                <jdbc.port>1433</jdbc.port>
                <jdbc.schema>dbo</jdbc.schema>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <systemPropertyVariables>
                                <jdbc.url>jdbc:sqlserver://${jdbc.host}:${jdbc.port};databaseName=${jdbc.database}</jdbc.url>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dao</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <test>*DaoTest</test>
                            <systemPropertyVariables>
                                <jdbc.user>${jdbc.user}</jdbc.user>
                                <jdbc.password>${jdbc.password}</jdbc.password>
                                <jdbc.schema>${jdbc.schema}</jdbc.schema>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <properties>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <jdbc.host>127.0.0.1</jdbc.host>
        <jdbc.user>webhooks</jdbc.user>
        <jdbc.password>webhooks</jdbc.password>
        <jdbc.schema />
        <jdbc.database>webhooks</jdbc.database>
        <jdbc.port />
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <configuration>
                    <extractDependencies>false</extractDependencies>
                    <containerId>tomcat9x</containerId>
                    <productVersion>${platform.version}</productVersion>
                    <output>${basedir}/target/output.log</output>
                    <banningExcludes>
                        <exclude>com.atlassian.webhooks:atlassian-webhooks-api</exclude>
                        <exclude>com.atlassian.webhooks:atlassian-webhooks-spi</exclude>
                    </banningExcludes>
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Private-Package>
                            com.atlassian.webhooks.internal*
                        </Private-Package>
                        <Import-Package>
                            <!-- Import the webhooks packages in case the host application exports the
                                 webhooks API/SPI -->
                            com.atlassian.webhooks;resolution:="optional",
                            com.atlassian.webhooks.diagnostics;resolution:="optional",
                            com.atlassian.webhooks.event;resolution:="optional",
                            com.atlassian.webhooks.history;resolution:="optional",
                            com.atlassian.webhooks.module;resolution:="optional",
                            com.atlassian.webhooks.request;resolution:="optional",
                            com.atlassian.webhooks.util;resolution:="optional",

                            com.atlassian.analytics.*;resolution:="optional",
                            com.atlassian.plugin.osgi.bridge.external;resolution:="optional",
                            com.atlassian.plugin.osgi.external;resolution:="optional",
                            com.atlassian.annotations.nullability;resolution:="optional",
                            com.atlassian.sal.api,
                            org.apache.commons.io.input;version="2.6",
                            org.springframework.osgi.*;resolution:="optional",
                            org.hibernate.validator.*;resolution:="optional",
                            org.jboss.logging*;resolution:="optional",
                            javax.annotation,
                            javax.validation*;resolution:="optional",
                            *
                        </Import-Package>
                        <Export-Package>
                            com.atlassian.webhooks;version="${project.version}",
                            com.atlassian.webhooks.diagnostics;version="${project.version}",
                            com.atlassian.webhooks.event;version="${project.version}",
                            com.atlassian.webhooks.history;version="${project.version}",
                            com.atlassian.webhooks.module;version="${project.version}",
                            com.atlassian.webhooks.request;version="${project.version}",
                            com.atlassian.webhooks.util;version="${project.version}",
                            com.atlassian.webhooks.migration;version="${project.version}",
                            com.atlassian.webhooks.external;version="${project.version}"
                        </Export-Package>
                        <!-- Ensure plugin is spring powered - see https://extranet.atlassian.com/x/xBS9hQ -->
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
