<?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.crowd</groupId>
        <artifactId>atlassian-embedded-crowd</artifactId>
        <version>7.0.0-platform-1</version>
    </parent>

    <artifactId>embedded-crowd-admin-plugin</artifactId>
    <name>Atlassian Embedded Crowd - Administration Plugin</name>
    <description>Provides the administration of local and remote user directories.</description>
    <packaging>atlassian-plugin</packaging>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-admin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-core</artifactId>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>jakarta.servlet</groupId>
                    <artifactId>jakarta.servlet-api</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-integration-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-events</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-ldap</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-password-encoders</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.platform</groupId>
            <artifactId>spring-velocity-support</artifactId>
        </dependency>
        <dependency>
            <groupId>org.dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>velocity-tools</groupId>
            <artifactId>velocity-tools</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Spring dependencies -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <!-- commons-logging is used by Spring -->
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.3</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <!-- Bundled privately for @Valid annotations, used with spring-mvc / spring-context. -->
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.woodstox</groupId>
            <artifactId>woodstox-core</artifactId>
            <version>${com.fasterxml.woodstox.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <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-webresource-common</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webresource</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-webfragment</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-v2-api</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>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-core</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.scheduler</groupId>
            <artifactId>atlassian-scheduler-caesium</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.reflections</groupId>
            <artifactId>reflections</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>amps-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <containerId>${amps.containerId}</containerId>
                    <output>${project.build.directory}/output.log</output>
                    <enableQuickReload>true</enableQuickReload>
                    <instructions>
                        <Export-Package>
                            com.atlassian.crowd.embedded.admin.authorisation*;version="${project.version}",
                            com.atlassian.crowd.embedded.admin.plugin*;version="${project.version}"
                        </Export-Package>
                        <!-- wildcards use introspection which doesn't work for references from Velocity, so they can't be used for SAL or plugins -->
                        <Import-Package>
                            com.atlassian.analytics.api.annotations;resolution:="optional",
                            com.atlassian.crowd.directory.ssl, <!-- needed as a class from this package is loaded via a Class.forName("") -->
                            com.atlassian.crowd.embedded.api.service,
                            com.atlassian.crowd.embedded.spi.service,
                            com.atlassian.velocity;resolution:="optional",
                            org.springframework.validation.beanvalidation,
                            io.atlassian.fugue*,
                            com.atlassian.scheduler*,
                            com.atlassian.event.api,
                            com.atlassian.sal.api,
                            com.atlassian.sal.api.message,
                            com.atlassian.sal.api.user,
                            com.atlassian.sal.api.transaction,
                            com.atlassian.sal.api.auth,
                            com.atlassian.sal.api.websudo,
                            com.atlassian.sal.api.features,
                            com.atlassian.sal.api.timezone,
                            com.atlassian.security.random,
                            com.atlassian.plugin.webresource,
                            com.atlassian.plugin.web,
                            com.atlassian.plugin.servlet,
                            com.atlassian.plugin.descriptors*,
                            com.atlassian.plugin.module*,
                            com.atlassian.plugin.util.validation*,
                            *;resolution:=optional
                        </Import-Package>
                    </instructions>

                    <products>
                        <product>
                            <id>refapp</id>
                            <version>${refapp.version}</version>
                            <jvmArgs>-Datlassian.darkfeature.embedded.crowd.directory.azuread.enabled=true</jvmArgs>
                            <bundledArtifacts>
                                <bundledArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>embedded-crowd-refapp-plugin</artifactId>
                                </bundledArtifact>
                            </bundledArtifacts>
                        </product>
                        <product>
                            <id>jira</id>
                            <version>8.15.0</version>
                            <httpPort>2990</httpPort>
                            <jvmDebugPort>5005</jvmDebugPort>
                            <jvmArgs>-Xmx768m -XX:MaxPermSize=300m -Dplugin.webresource.batching.off=false</jvmArgs>
                            <bundledArtifacts>
                                <bundledArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>embedded-crowd-admin-plugin</artifactId>
                                </bundledArtifact>
                            </bundledArtifacts>
                        </product>
                    </products>

                    <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}/package-lock.json</includedFeModuleManifest>
                    </includedFeModuleManifests>

                    <feManifestAssociations>
                        <feManifestAssociation>
                            <!-- package name of the frontend package -->
                            <packageName>@atlassian/dc.embedded-crowd.embedded-crowd-admin-plugin</packageName>
                            <manuallyVerifiedEveryFileHasItsDependenciesDeclaredInTheManifest>
                                <outputDirectoryFiles>
                                    web/configure-azuread-min.js,
                                    web/configure-azuread.js,
                                    web/configure-password-policy-min.js,
                                    web/configure-password-policy.js,
                                    web/directory-configuration-min.js,
                                    web/directory-configuration.js,
                                    web/embedded-crowd-admin-min.js,
                                    web/embedded-crowd-admin.js,
                                    web/soy-namespace-setup-min.js,
                                    web/soy-namespace-setup.js,
                                    web/user-sync-preview-min.js,
                                    web/user-sync-preview.js,
                                </outputDirectoryFiles>
                            </manuallyVerifiedEveryFileHasItsDependenciesDeclaredInTheManifest>
                        </feManifestAssociation>
                    </feManifestAssociations>
                </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>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-resources-licenses</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.outputDirectory}/licenses</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${thirdpartylicensing.licenses}</directory>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-resources-bom</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>${thirdpartylicensing.dir}</directory>
                                            <includes>
                                                <include>bom.csv</include>
                                            </includes>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
