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

    <parent>
        <groupId>com.atlassian.oauth2</groupId>
        <artifactId>oauth2-provider-parent</artifactId>
        <version>6.0.0</version>
    </parent>

    <artifactId>oauth2-provider-plugin</artifactId>
    <packaging>atlassian-plugin</packaging>

    <name>Atlassian OAuth 2 Provider - Plugin</name>
    <description>Plugin for Atlassian OAuth 2 Provider</description>

    <properties>
        <bamboo.buildKey>UNKNOWN</bamboo.buildKey>
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
        <frontend.maven.plugin.version>1.15.1-atlassian-6</frontend.maven.plugin.version>
        <yarn.cmd.install>yarn install --immutable</yarn.cmd.install>
        <yarn.cmd.install.dev>yarn install --immutable</yarn.cmd.install.dev>
        <yarn.cmd.build>yarn run build</yarn.cmd.build>
        <yarn.cmd.build.dev>yarn run build:dev</yarn.cmd.build.dev>
    </properties>

    <dependencies>
        <!-- Module dependencies -->
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-provider-rest</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-provider-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-provider-core</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-scopes-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.audit</groupId>
            <artifactId>atlassian-audit-api</artifactId>
            <version>${atlassian.audit.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.secrets</groupId>
            <artifactId>atlassian-secrets-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.annotations</groupId>
            <artifactId>atlassian-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.nimbusds</groupId>
            <artifactId>oauth2-oidc-sdk</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-integration-api</artifactId>
            <version>${crowd.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-server-api</artifactId>
            <version>${crowd.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.json</groupId>
            <artifactId>atlassian-json-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.analytics</groupId>
            <artifactId>analytics-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.seraph</groupId>
            <artifactId>atlassian-seraph</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.framework</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.beehive</groupId>
            <artifactId>beehive-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-api</artifactId>
            <version>${bitbucket.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bamboo</groupId>
            <artifactId>atlassian-bamboo-api</artifactId>
            <version>${bamboo.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Test Dependencies -->
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-provider-core</artifactId>
            <type>test-jar</type>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.bitbucket.server</groupId>
            <artifactId>bitbucket-test-util</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.14</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>4.4.16</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-admin-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson2-provider</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-webdriver-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.testutils</groupId>
            <artifactId>atlassian-test-annotations</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-client-api</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-func-test</artifactId>
            <version>${project.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.oauth2</groupId>
            <artifactId>oauth2-client-rest</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j2-impl</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>${log4j2.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>tools.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <!-- Install front-end modules and run ESLint -->
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend.maven.plugin.version}</version>
                <configuration>
                    <installDirectory>${frontend.maven.plugin.install.directory}</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install-node-and-corepack</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>install-node-and-corepack</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>install-prod-dependencies</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>corepack</goal>
                        </goals>
                        <configuration>
                            <arguments>${yarn.cmd.install}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile-the-ui</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>corepack</goal>
                        </goals>
                        <configuration>
                            <arguments>${yarn.cmd.build}</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>lint</id>
                        <goals>
                            <goal>corepack</goal>
                        </goals>
                        <configuration>
                            <arguments>yarn run lint</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>typecheck</id>
                        <goals>
                            <goal>corepack</goal>
                        </goals>
                        <configuration>
                            <arguments>yarn run typecheck</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>corepack</goal>
                        </goals>
                        <configuration>
                            <arguments>yarn run test</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <enableQuickReload>true</enableQuickReload>
                    <processI18nUsage>false</processI18nUsage>

                    <expectedImportsPath>${project.basedir}/src/test/resources/expected-imports.txt</expectedImportsPath>

                    <includedFeModuleManifests>
                        <!-- Required to know what is development only & useful for other future projects -->
                        <includedFeModuleManifest>${project.basedir}/package.json</includedFeModuleManifest>
                        <!-- Required so all versions of all transitive dependencies are declared -->
                        <includedFeModuleManifest>${project.basedir}/yarn.lock</includedFeModuleManifest>
                    </includedFeModuleManifests>

                    <feManifestAssociations>
                        <feManifestAssociation>
                            <packageName>@atlassian/dc.shared.atlassian-oauth2.provider-plugin</packageName>
                            <manuallyVerifiedEveryFileHasItsDependenciesDeclaredInTheManifest>
                                <outputDirectoryFiles>
                                    js/oauth2-consent.js,
                                    js/oauth2-consent-min.js
                                </outputDirectoryFiles>
                            </manuallyVerifiedEveryFileHasItsDependenciesDeclaredInTheManifest>
                        </feManifestAssociation>
                    </feManifestAssociations>

                    <libArtifacts>
                        <libArtifact>
                            <groupId>com.atlassian.oauth2</groupId>
                            <artifactId>oauth2-scopes-api</artifactId>
                            <version>${project.version}</version>
                        </libArtifact>
                        <libArtifact>
                            <groupId>com.atlassian.oauth2</groupId>
                            <artifactId>oauth2-provider-api</artifactId>
                            <version>${project.version}</version>
                        </libArtifact>
                        <libArtifact>
                            <groupId>com.atlassian.audit</groupId>
                            <artifactId>atlassian-audit-api</artifactId>
                            <version>${atlassian.audit.version}</version>
                        </libArtifact>
                    </libArtifacts>

                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.oauth2</groupId>
                            <artifactId>oauth2-scopes-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>

                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
                        <Import-Package>
                            org.springframework.osgi.*;resolution:="optional",
                            org.eclipse.gemini.blueprint.*;resolution:="optional",
                            com.atlassian.analytics.api.*;resolution:="optional",
                            com.atlassian.seraph.*;resolution:="optional",
                            com.atlassian.oauth2.scopes.api.*,
                            com.atlassian.plugins.osgi.javaconfig.*;resolution:="optional",
                            org.slf4j.*;resolution:="optional",
                            com.atlassian.bitbucket.*;resolution:="optional",
                            com.atlassian.confluence.*;resolution:="optional",
                            com.google.gson*;resolution:="optional",
                            com.atlassian.user*;resolution:="optional",
                            com.atlassian.jira.*;resolution:="optional",
                            com.atlassian.bamboo.*;resolution:="optional",
                            com.atlassian.crowd.*;resolution:="optional",
                            com.atlassian.sal.*;resolution:="optional",
                            io.atlassian.util.concurrent*;resolution:="optional",
                            org.acegisecurity.userdetails*;resolution:="optional",
                            com.atlassian.oauth2.provider.rest.service*;resolution:="optional",
                            !lombok,
                            !javax.servlet*,
                            <!-- exclude pocketknife bits we don't need -->
                            !net.sf.cglib.proxy,
                            !org.jvnet.hudson.annotation_indexer,
                            !com.google.gson.stream,
                            !com.google.crypto.tink.subtle,
                            !com.ibm.uvm.tools,
                            !com.sun.jdmk.comm,
                            !javax.jmdns,
                            !javax.jms,
                            !net.sf.ehcache,
                            !net.spy.memcached,
                            !net.shibboleth.*,
                            !org.apache.avalon.framework*,
                            !org.apache.log,
                            !org.cryptomator.*,
                            !sun.security.util,
                            !com.mysema.query.*,
                            !com.mysema.query.spatial.path,
                            !com.mysema.query.spatial,
                            !org.postgis,
                            !org.bouncycastle.*,
                            !org.opensaml.*,
                            !oracle.spatial.geometry,
                            !org.geolatte.geom,
                            !org.geolatte.geom.codec,
                            !org.geolatte.geom.crs,
                            !bsh,
                            !sun.misc,
                            !org.reflections*,
                            !com.sun.research.ws.wadl,
                            !com.sun.activation.registries,
                            !org.joda.time,
                            !io.grpc.override,
                            *
                        </Import-Package>
                        <Spring-Context>*</Spring-Context>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>watch-mode</id>
            <properties>
                <yarn.cmd.install>${yarn.cmd.install.dev}</yarn.cmd.install>
                <yarn.cmd.build>${yarn.cmd.build.dev}</yarn.cmd.build>
            </properties>
        </profile>
    </profiles>


</project>