<?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.0.9</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>7.5.0</confluence.version>
        <!-- other properties -->
        <ajp.port>8109</ajp.port>
        <amps.version>8.0.2</amps.version>
        <atlassian.gadgets.version>4.3.2.1</atlassian.gadgets.version>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <atlassian.spring.scanner.version>2.1.5</atlassian.spring.scanner.version>
        <confapi-commons.version>0.0.31-SNAPSHOT</confapi-commons.version>
        <confluence-lookandfeel.version>5.9.1-issue-CONF-38693-m2</confluence-lookandfeel.version>
        <custom-favicon-api.version>2.0.2</custom-favicon-api.version>
        <javax.el-api.version>3.0.0</javax.el-api.version>
        <log4j.version>2.8.2</log4j.version>
        <plugin.testrunner.version>2.0.1</plugin.testrunner.version>
        <powermock-api-easymock.version>2.0.7</powermock-api-easymock.version>
        <slf4j.version>1.7.30</slf4j.version>
    </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>

        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <scope>compile</scope>
        </dependency>

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

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <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-lookandfeel.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>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <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>

        <!-- 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>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.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.web</groupId>
            <artifactId>javax.el</artifactId>
            <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.powermock</groupId>
            <artifactId>powermock-api-easymock</artifactId>
            <version>${powermock-api-easymock.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>${powermock-api-easymock.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>

        <dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>org.jacoco.agent</artifactId>
            <classifier>runtime</classifier>
            <scope>test</scope>
            <version>0.8.5</version>
        </dependency>

    </dependencies>

    <build>

        <!-- plugins -->

        <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>7.5.0</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>${openapi-generator-maven-plugin.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>
        </plugins>
    </build>

</project>
