<?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>8.0.0-platform-01</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>

    <properties>
        <atlassian.plugin.key>com.atlassian.crowd.embedded.admin</atlassian.plugin.key>
        <!-- Use latest Atlassian fork; node/yarn versions are auto-detected from
             package.json#packageManager and .nvmrc/.node-version — no need to pin here -->
        <frontend.maven.plugin.version>1.15.1-atlassian-6</frontend.maven.plugin.version>
        <frontend.maven.plugin.install.directory>${project.build.directory}</frontend.maven.plugin.install.directory>
        <frontend.working.directory>${project.basedir}</frontend.working.directory>
        <frontend.cmd.install>install</frontend.cmd.install>
        <frontend.cmd.build>build</frontend.cmd.build>
        <frontend.cmd.watch.prepare>start</frontend.cmd.watch.prepare>
        <frontend.build.mode>production</frontend.build.mode>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-admin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-javaconfig</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.3.5</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>jakarta.inject</groupId>
            <artifactId>jakarta.inject-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.annotation</groupId>
            <artifactId>jakarta.annotation-api</artifactId>
            <scope>provided</scope>
        </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-osgi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.plugins</groupId>
            <artifactId>atlassian-plugins-osgi-bridge</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.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Woodstox is required for servlet XML processing -->
        <dependency>
            <groupId>com.fasterxml.woodstox</groupId>
            <artifactId>woodstox-core</artifactId>
            <version>${com.fasterxml.woodstox.version}</version>
        </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>tools.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>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>embedded-crowd-testkit-plugin</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.stefanbirkner</groupId>
            <artifactId>system-rules</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>
                    <!-- TODO: KRAK-8445 remove after com.fasterxml.woodstox:woodstox-core is set to provided -->
                    <skipBanningDependencies>true</skipBanningDependencies>
                    <instructions>
                        <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                        <Spring-Context>*</Spring-Context>
                        <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.confluence.rest.serialization.jackson3;resolution:="optional", <!-- RequestMappingHandlerAdapter instantiates spring which then runs MapperBuilder.findModules(), which in Jackson3 fails hard if an auto discovered module cannot be loaded -->
                            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*,
                            javax.xml.*;resolution:=optional,
                            !javax.*,
                            *;resolution:=optional
                        </Import-Package>
                        <Atlassian-Scan-Folders>META-INF/plugin-descriptors</Atlassian-Scan-Folders>
                    </instructions>

                    <systemPropertyVariables>
                        <crowd.directory.deprecated.types.enabled>true</crowd.directory.deprecated.types.enabled>
                    </systemPropertyVariables>

                    <products>
                        <product>
                            <id>refapp</id>
                            <version>${refapp.version}</version>
                            <jvmArgs>-Datlassian.darkfeature.embedded.crowd.directory.azuread.enabled=true -Denable.csp.violation.logging=true -Drefapp.csp.default-nonce=default+nonce+for+testing -Datlassian.refapp.websudo.disabled=true</jvmArgs>
                            <bundledArtifacts>
                                <bundledArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>embedded-crowd-refapp-plugin</artifactId>
                                </bundledArtifact>
                                <bundledArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>embedded-crowd-testkit-plugin</artifactId>
                                </bundledArtifact>
                            </bundledArtifacts>
                            <!-- Overriding artifacts until the product bundles them -->
                            <libArtifacts>
                                <libArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-api</artifactId>
                                </libArtifact>
                                <libArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-common</artifactId>
                                </libArtifact>
                                <libArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-ldap</artifactId>
                                </libArtifact>
                            </libArtifacts>
                        </product>
                        <product>
                            <id>jira</id>
                            <version>12.0.0-QR-20260901070829</version>
                            <httpPort>2990</httpPort>
                            <jvmDebugPort>5005</jvmDebugPort>
                            <jvmArgs>-Dplugin.webresource.batching.off=false</jvmArgs>
                            <bundledArtifacts>
                                <bundledArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>embedded-crowd-admin-plugin</artifactId>
                                </bundledArtifact>
                                <bundledArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>embedded-crowd-testkit-plugin</artifactId>
                                </bundledArtifact>
                            </bundledArtifacts>
                            <!-- Overriding artifacts until the product bundles them -->
                            <libArtifacts>
                                <libArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-api</artifactId>
                                </libArtifact>
                                <libArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-common</artifactId>
                                </libArtifact>
                                <libArtifact>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-ldap</artifactId>
                                </libArtifact>
                            </libArtifacts>
                        </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}/yarn.lock</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-ldap-min.js,
                                    web/configure-ldap.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>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend.maven.plugin.version}</version>
                <configuration>
                    <!-- node version auto-detected from .node-version / package.json#engines -->
                    <!-- yarn version auto-detected from package.json#packageManager via corepack -->
                    <installDirectory>${frontend.maven.plugin.install.directory}</installDirectory>
                    <workingDirectory>${frontend.working.directory}</workingDirectory>
                    <environmentVariables>
                        <NODE_ENV>${frontend.build.mode}</NODE_ENV>
                    </environmentVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>step-1-install-node-and-corepack</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>install-node-and-corepack</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>step-2-install-dependencies</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>corepack</goal>
                        </goals>
                        <configuration>
                            <arguments>yarn ${frontend.cmd.install}</arguments>
                            <environmentVariables>
                                <NODE_ENV>development</NODE_ENV>
                            </environmentVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>build-mode-is-set-by-node-env</id>
            <activation>
                <property>
                    <name>env.NODE_ENV</name>
                </property>
            </activation>
            <properties>
                <frontend.build.mode>${env.NODE_ENV}</frontend.build.mode>
            </properties>
        </profile>
        <profile>
            <id>build</id>
            <activation>
                <property>
                    <name>!watchMode</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <configuration>
                            <installDirectory>${frontend.maven.plugin.install.directory}</installDirectory>
                            <workingDirectory>${frontend.working.directory}</workingDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>step-3-build-frontend</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>corepack</goal>
                                </goals>
                                <configuration>
                                    <arguments>yarn ${frontend.cmd.build}</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>watch-prepare</id>
            <activation>
                <property>
                    <name>watchMode</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <configuration>
                            <installDirectory>${frontend.maven.plugin.install.directory}</installDirectory>
                            <workingDirectory>${frontend.working.directory}</workingDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>step-3-watch-prepare-frontend</id>
                                <phase>process-resources</phase>
                                <goals>
                                    <goal>corepack</goal>
                                </goals>
                                <configuration>
                                    <arguments>yarn ${frontend.cmd.watch.prepare}</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <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>
