<?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.plugins</groupId>
        <artifactId>static-assets-url-root</artifactId>
        <version>5.2.3</version>
    </parent>

    <artifactId>static-assets-url</artifactId>

    <name>Static Assets (CDN) Plugin</name>
    <description>
        This is the Static Assets plugin for Atlassian products.
        Provides support for adding CDN and caching functionality for static assets.
    </description>
    <packaging>atlassian-plugin</packaging>

    <properties>
        <!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
        <!-- Keep it in sync with 'pluginKey' in webpack.config.js -->
        <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>static-assets-url-api</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webfragment-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-core</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.analytics</groupId>
            <artifactId>analytics-client-exported</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugin</groupId>
            <artifactId>atlassian-spring-scanner-annotation</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.soy</groupId>
            <artifactId>soy-template-renderer-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.cache</groupId>
            <artifactId>atlassian-cache-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.audit</groupId>
            <artifactId>atlassian-audit-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <!-- Minimum supported Jira -->
            <version>${jira.version}</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>2.28.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.rest-assured</groupId>
            <artifactId>rest-assured</artifactId>
            <version>${rest.assured.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>commons-codec</groupId>
                    <artifactId>commons-codec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- For REST Assured tests -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend.maven.plugin.version}</version>
                <configuration>
                    <installDirectory>${project.build.directory}</installDirectory>
                    <workingDirectory>${project.basedir}</workingDirectory>
                    <nodeVersion>${node.version}</nodeVersion>
                    <yarnVersion>${yarn.version}</yarnVersion>
                    <installDirectory>${node.path}</installDirectory>
                    <npmInheritsProxyConfigFromMaven>true</npmInheritsProxyConfigFromMaven>
                </configuration>
                <executions>
                    <execution>
                        <id>install node and yarn</id>
                        <goals>
                            <goal>install-node-and-yarn</goal>
                        </goals>
                        <phase>initialize</phase>
                        <inherited>false</inherited>
                    </execution>
                    <execution>
                        <id>yarn install</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>${frontend.install.cmd}</arguments>
                        </configuration>
                        <phase>initialize</phase>
                        <inherited>false</inherited>
                    </execution>
                    <execution>
                        <id>webpack build</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>${yarn.build}</arguments>
                        </configuration>
                        <phase>process-resources</phase>
                    </execution>
                    <execution>
                        <id>install-dev-dependencies</id>
                        <phase>test</phase>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>${frontend.install.cmd.dev}</arguments>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-checks</id>
                        <phase>test</phase>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>verify</arguments>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-tests</id>
                        <phase>test</phase>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <configuration>
                            <arguments>test</arguments>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <allowGoogleTracking>false</allowGoogleTracking>
                    <banningExcludes>
                        <!-- This plugin bundles/exports this platform API. Exclude it from the AMPS bundling check. -->
                        <exclude>com.atlassian.plugins:static-assets-url-api</exclude>
                    </banningExcludes>
                    <enableQuickReload>true</enableQuickReload>
                    <compressJs>false</compressJs>
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
                        <Spring-Context>*</Spring-Context>
                        <Export-Package>
                            com.atlassian.plugins.cdn.api*;version="${project.version}";atlassian-access=public
                        </Export-Package>
                        <Import-Package>
                            com.atlassian.jira*;resolution:=optional,
                            com.atlassian.jira.*;resolution:=optional,
                            com.atlassian.gadgets.event*;resolution:=optional,
                            *
                        </Import-Package>
                    </instructions>
                    <skipManifestValidation>true</skipManifestValidation>
                    <products>
                        <product>
                            <id>jira</id>
                            <version>${jira.version}</version>
                        </product>
                        <product>
                            <id>confluence</id>
                            <version>${confluence.version}</version>
                        </product>
                        <product>
                            <id>bitbucket</id>
                            <version>${bitbucket.version}</version>
                        </product>
                        <product>
                            <id>refapp</id>
                            <version>${platform.version}</version>
                            <output>${project.build.directory}/refapp.log</output>
                        </product>
                    </products>
                    <testGroups>
                        <testGroup>
                            <id>confluence</id>
                            <productIds>
                                <productId>confluence</productId>
                            </productIds>
                        </testGroup>
                        <testGroup>
                            <id>jira</id>
                            <productIds>
                                <productId>jira</productId>
                            </productIds>
                        </testGroup>
                        <testGroup>
                            <id>bitbucket</id>
                            <productIds>
                                <productId>bitbucket</productId>
                            </productIds>
                        </testGroup>
                        <testGroup>
                            <id>refapp</id>
                            <productIds>
                                <productId>refapp</productId>
                            </productIds>
                        </testGroup>
                    </testGroups>
                    <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>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.plugins</groupId>
                            <artifactId>react</artifactId>
                            <version>1.0.1-18.3.1</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                </configuration>
                <executions>
                    <execution>
                        <id>js-enforcement</id>
                        <goals>
                            <goal>verify-fe-manifest-associations</goal>
                        </goals>
                        <phase>verify</phase>
                        <configuration>
                            <verifyFeManifestAssociationsInputEntrypoint>
                                ${project.build.directory}/${project.build.finalName}.jar
                            </verifyFeManifestAssociationsInputEntrypoint>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.plugin</groupId>
                <artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
                <version>${atlassian.spring.scanner.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>atlassian-spring-scanner</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
                <configuration>
                    <verbose>false</verbose>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>node_modules</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.43.0</version>
                <configuration>
                    <java>
                        <palantirJavaFormat>
                            <version>2.28.0</version>
                        </palantirJavaFormat>
                        <importOrder>
                            <wildcardsLast>true</wildcardsLast>
                            <order>java|javax|jakarta,lombok,org.spring|org|com|io,,com.atlassian,com.atlassian.beacon|\#,\#com.atlassian</order>
                        </importOrder>
                        <removeUnusedImports />
                    </java>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>dev.mode</id>
            <properties>
                <frontend.install.cmd>${frontend.install.cmd.dev}</frontend.install.cmd>
                <yarn.build>build:dev</yarn.build>
            </properties>
        </profile>
    </profiles>
</project>
