<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (C) 2016-2022 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     https://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<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>

    <parent>
        <artifactId>connector-parent</artifactId>
        <groupId>com.evolveum.polygon</groupId>
        <version>1.5.2.0</version>
    </parent>

    <artifactId>connector-csv</artifactId>
    <version>2.9</version>
    <packaging>jar</packaging>

    <name>CSV Connector</name>

    <properties>
        <project.source.version>17</project.source.version>

        <connectorPackage>com.evolveum.polygon.connector.csv</connectorPackage>
        <connectorClass>CsvConnector</connectorClass>

        <commons.csv.version>1.10.0</commons.csv.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>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
            </plugin>
            <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>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
            <version>${commons.csv.version}</version>
        </dependency>

        <!-- TEST DEPENDENCIES -->

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.15.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <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>
        <profile>
            <id>dependencytrack</id>
            <build>
                <plugins>
                    <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>
                        <executions>
                            <execution>
                                <id>upload-bom</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>upload-bom</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
