<?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>de.aservo</groupId>
        <artifactId>parent-pom</artifactId>
        <version>0.0.11</version>
    </parent>

    <artifactId>confapi-confluence-plugin</artifactId>
    <version>0.1.1</version>
    <packaging>atlassian-plugin</packaging>

    <name>ConfAPI for Confluence</name>
    <description>ConfAPI for Confluence provides a REST API for automated configuration tasks.</description>
    <url>https://github.com/aservo/confapi-confluence-plugin</url>

    <organization>
        <name>ASERVO Software GmbH</name>
        <url>https://www.aservo.com</url>
    </organization>

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

    <issueManagement>
        <system>Github</system>
        <url>https://github.com/aservo/confapi-confluence-plugin/issues</url>
    </issueManagement>

    <scm>
        <connection>scm:git:git://github.com/aservo/confapi-confluence-plugin.git</connection>
        <developerConnection>scm:git:git@github.com:aservo/confapi-confluence-plugin.git</developerConnection>
        <url>https://github.com/aservo/confapi-confluence-plugin</url>
    </scm>

    <developers>
        <developer>
            <name>Patrick Hobusch</name>
            <email>phobusch@aservo.com</email>
            <organization>ASERVO Software GmbH</organization>
            <organizationUrl>https://www.aservo.com</organizationUrl>
        </developer>
        <developer>
            <name>Kai Lehmann</name>
            <email>klehmann@aservo.com</email>
            <organization>ASERVO Software GmbH</organization>
            <organizationUrl>https://www.aservo.com</organizationUrl>
        </developer>
    </developers>

    <properties>
        <confluence.version>8.5.6</confluence.version>
        <confluence.data.version>8.5.6</confluence.data.version>
        <!-- other properties -->
        <ajp.port>8109</ajp.port>
        <amps.version>8.12.4</amps.version>
        <atlassian.gadgets.version>8.1.4</atlassian.gadgets.version>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <atlassian.spring.scanner.version>2.2.4</atlassian.spring.scanner.version>
        <confapi-commons.version>0.5.0</confapi-commons.version>
        <custom-favicon-api.version>2.0.2</custom-favicon-api.version>
        <javax.jaxb-api.version>2.3.1</javax.jaxb-api.version>
        <javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
        <javax.el-api.version>3.0.0</javax.el-api.version>
        <plugin.testrunner.version>2.0.4</plugin.testrunner.version>
        <log4j.version>2.23.0</log4j.version>
        <slf4j.version>2.0.12</slf4j.version>
        <swagger.version>2.2.20</swagger.version>
        <openai-generator.version>7.3.0</openai-generator.version>
        <!-- Compiler must be 8 so that the plugin can run on Crowd instances using Java 8 -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

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

            <!-- not working, use for version references -->
            <dependency>
                <groupId>com.atlassian.confluence</groupId>
                <artifactId>confluence-bundled-plugins-library</artifactId>
                <version>${confluence.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>de.aservo</groupId>
                <artifactId>confapi-commons</artifactId>
                <version>${confapi-commons.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>

        <!-- compile dependencies -->

        <dependency>
            <groupId>de.aservo</groupId>
            <artifactId>confapi-commons</artifactId>
            <version>${confapi-commons.version}</version>
            <scope>compile</scope>
        </dependency>

        <!-- behaves like a compile dependency -->

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.28</version>
            <scope>provided</scope>
        </dependency>

        <!-- provided dependencies -->

        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.applinks</groupId>
            <artifactId>applinks-plugin</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-lookandfeel</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.favicon</groupId>
            <artifactId>custom-favicon-api</artifactId>
            <version>${custom-favicon-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-rest-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>${javax.jaxb-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>${javax.ws.rs-api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <version>${atlassian.spring.scanner.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-api</artifactId>
            <version>${atlassian.gadgets.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-spi</artifactId>
            <version>${atlassian.gadgets.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>net.sourceforge.findbugs</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins.authentication</groupId>
            <artifactId>atlassian-authentication-plugin</artifactId>
            <version>4.3.8</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>${swagger.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-jaxrs2</artifactId>
            <version>${swagger.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- test dependencies -->

        <dependency>
            <groupId>de.aservo</groupId>
            <artifactId>confapi-commons</artifactId>
            <version>${confapi-commons.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.wink</groupId>
            <artifactId>wink-client</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.el</groupId>
            <artifactId>javax.el-api</artifactId>
            <version>${javax.el-api.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.el</artifactId>
            <version>${javax.el-api.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-testrunner</artifactId>
            <version>${plugin.testrunner.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-to-slf4j</artifactId>
            <version>${log4j.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>confluence-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <ajpPort>${ajp.port}</ajpPort>
                    <productVersion>${confluence.version}</productVersion>
                    <!-- the following version may only be adjusted, when a new home zip has been generated -->
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                    <!-- in case new home zip should be generated, please add your executed steps to generated-test-resources.md -->
                    <productDataPath>${project.basedir}/src/test/resources/generated-test-resources.zip</productDataPath>
                    <enableQuickReload>true</enableQuickReload>
                    <jvmArgs>-Xms1g -Xmx4g -XX:MaxPermSize=1g -XX:-UseGCOverheadLimit -server</jvmArgs>
                    <!-- See here for an explanation of default instructions: -->
                    <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Import-Package>
                            *;version="0";resolution:=optional
                        </Import-Package>
                        <Export-Package/>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>copy-bundled-dependencies</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
                <version>${swagger.version}</version>
                <configuration>
                    <openapiFilePath>${basedir}/src/main/resources/openapi.yaml</openapiFilePath>
                    <resourcePackages>
                        <resourcePackage>de.aservo.confapi.confluence.rest</resourcePackage>
                    </resourcePackages>
                    <outputPath>${project.build.directory}</outputPath>
                    <outputFormat>YAML</outputFormat>
                    <prettyPrint>true</prettyPrint>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>resolve</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openai-generator.version}</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.build.directory}/openapi.yaml</inputSpec>
                            <generatorName>asciidoc</generatorName>
                            <output>${project.basedir}</output>
                            <skipValidateSpec>true</skipValidateSpec>
                            <additionalProperties>
                                <additionalProperty>specDir=src/main/resources/openapi/specs/</additionalProperty>
                                <additionalProperty>snippetDir=src/main/resources/openapi/snippets/</additionalProperty>
                            </additionalProperties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.plugin.version}</version>
            </plugin>

            <!-- Override Nexus Staging version from parent pom -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.6.13</version>
            </plugin>
        </plugins>
    </build>

</project>
