<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2025 Evolveum and contributors
  ~
  ~ This work is licensed under European Union Public License v1.2. See LICENSE file for details.
  ~
  -->
<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>

    <groupId>com.evolveum.polygon.scimrest</groupId>
    <artifactId>connector-scimrest-parent</artifactId>
    <version>0.1-preview-mcm</version>
    <packaging>pom</packaging>

    <name>Polygon SCIM 2 Connector - Root</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.source.version>17</project.source.version>
        <project.target.version>17</project.target.version>
        <polygon.version>1.5.3.0-M3</polygon.version>
        <connId.version>1.7.0.0-SNAPSHOT</connId.version>
        <unboundid-scim2.version>3.2.0</unboundid-scim2.version>

        <surefire.version>3.5.2</surefire.version>
        <failsafe.version>3.5.2</failsafe.version>
        <testng.version>7.10.2</testng.version>
        <groovy.version>4.0.25</groovy.version>
    </properties>

    <repositories>
        <repository>
            <id>evolveum-nexus-releases</id>
            <name>Internal Releases</name>
            <url>https://nexus.evolveum.com/nexus/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>evolveum-nexus-snapshots</id>
            <name>Internal Releases</name>
            <url>https://nexus.evolveum.com/nexus/content/repositories/snapshots/</url>
        </repository>
    </repositories>

    <distributionManagement>
        <repository>
            <id>evolveum-nexus</id>
            <name>Internal Releases</name>
            <url>https://nexus.evolveum.com/nexus/repository/releases/</url>
        </repository>
        <snapshotRepository>
            <id>evolveum-nexus</id>
            <name>Internal Snapshots</name>
            <url>https://nexus.evolveum.com/nexus/repository/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <modules>
        <module>common</module>
        <module>connector</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.unboundid.product.scim2</groupId>
                <artifactId>scim2-sdk-client</artifactId>
                <version>${unboundid-scim2.version}</version>
            </dependency>
            <dependency>
                <groupId>com.evolveum.polygon</groupId>
                <artifactId>connector-common</artifactId>
                <version>${polygon.version}</version>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng.version}</version>
            </dependency>
            <dependency>
                <groupId>net.tirasa.connid</groupId>
                <artifactId>connector-framework</artifactId>
                <version>${connId.version}</version>
            </dependency>
            <dependency>
                <groupId>org.wiremock</groupId>
                <artifactId>wiremock</artifactId>
                <version>3.13.2</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <!-- surefire-testng dependency needed until common-parent is updated to 1.5.3.0-SNAPSHOT at least -->
                <!-- reason: maven by default uses junit platform therefore all testng tests are skipped silently -->
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-testng</artifactId>
                        <version>3.5.1</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.12.1</version>
                    <configuration>
                        <source>${project.source.version}</source>
                        <target>${project.source.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <!-- Declare this plugin in the connector build to add sources (just groupId+artifactId). -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                    <configuration>
                        <includes>
                            <include>**/Test*.java</include>
                            <include>**/*Test.java</include>
                            <include>**/*Tests.java</include>
                            <include>**/*TestCase.java</include>
                        </includes>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.surefire</groupId>
                            <artifactId>surefire-testng</artifactId>
                            <version>${surefire.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${failsafe.version}</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.surefire</groupId>
                            <artifactId>surefire-testng</artifactId>
                            <version>${failsafe.version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <groupId>io.github.pmckeown</groupId>
                    <artifactId>dependency-track-maven-plugin</artifactId>
                    <version>1.7.0</version>
                    <configuration>
                        <dependencyTrackBaseUrl>${env.DTRACK_URL}</dependencyTrackBaseUrl>
                        <apiKey>${env.DTRACK_TOKEN}</apiKey>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>sbom</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.cyclonedx</groupId>
                        <artifactId>cyclonedx-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sbom-package</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>makeBom</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
