<?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.jira.plugins</groupId>
        <artifactId>insight-parent-pom</artifactId>
        <version>20.3.13-REL-0001</version>
    </parent>

    <groupId>com.atlassian.servicedesk</groupId>
    <artifactId>insight-rest-api</artifactId>
    <packaging>jar</packaging>

    <name>Assets Public REST APIs</name>

    <properties>
        <public.xsl.directory>${project.build.directory}/public-xsl</public.xsl.directory>
        <public.rest.doc.directory>${project.build.directory}/public-rest-api-docs</public.rest.doc.directory>
        <skip.test.enforcer>false</skip.test.enforcer>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.theme</groupId>
            <artifactId>atlassian-theme-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.zxing</groupId>
            <artifactId>core</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>jira-servicedesk-internal-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Assets/Insight dependencies -->
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-api-old</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-core-model</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-core-services</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-core-utils</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-core-persistence</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-core-index</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-core-iql</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.servicedesk</groupId>
            <artifactId>insight-external-services</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- javax dependencies -->
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Test dependencies -->
        <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.mockito.kotlin</groupId>
            <artifactId>mockito-kotlin</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-common</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.instancio</groupId>
            <artifactId>instancio-junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.instancio</groupId>
            <artifactId>instancio-core</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- needed for doc generation -->
        <dependency><!-- for some obscure reason it needs to be a module dep and not just a dep of the antrun plugin (ask Min'an) -->
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-doclet</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- Runtime, com.sun.xml.bind module -->
        <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.module</groupId>
            <artifactId>jackson-module-jaxb-annotations</artifactId>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.dc.swagger</groupId>
            <artifactId>annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.dc.swagger</groupId>
            <artifactId>jsm-swagger-processor</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.annotations</groupId>
            <artifactId>atlassian-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <executions>
                        <!-- Replacing default-compile as it is treated specially by maven -->
                        <execution>
                            <id>default-compile</id>
                            <phase>none</phase>
                        </execution>
                        <!-- Replacing default-testCompile as it is treated specially by maven -->
                        <execution>
                            <id>default-testCompile</id>
                            <phase>none</phase>
                        </execution>
                        <execution>
                            <id>java-compile</id>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>java-test-compile</id>
                            <phase>test-compile</phase>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jetbrains.kotlin</groupId>
                <artifactId>kotlin-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- generate, package and deploy the REST APIs documentation -->
            <id>release-profile</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <property>
                    <name>jira.generateDocs</name>
                </property>
            </activation>
            <properties>
                <maven.javadoc.skip>true</maven.javadoc.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.swagger.core.v3</groupId>
                        <artifactId>swagger-maven-plugin</artifactId>
                        <version>${swagger.version}</version>
                        <configuration>
                            <resourcePackages>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.openapi</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.analytics</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.aql</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.attachment</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.comment</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.icon</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.index</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.objectattribute</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.objecttickets</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.object</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.objectschema</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.objecttype</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.objecttypeattribute</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.progress</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.qrcode</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.status</resourcePackage>
                                <resourcePackage>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.archiving</resourcePackage>
                            </resourcePackages>
                            <outputPath>${project.build.directory}/site</outputPath>
                            <outputFileName>swagger</outputFileName>
                            <outputFormat>JSONANDYAML</outputFormat>
                            <prettyPrint>true</prettyPrint>
                            <scannerClass>com.riadalabs.jira.plugins.insight.channel.web.api.rest.services.openapi.AssetsEnricher</scannerClass>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>com.atlassian.dc.swagger</groupId>
                                <artifactId>jsm-swagger-processor</artifactId>
                                <version>${jsm.swagger.processor.version}</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>resolve</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
