<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2023 Johns Hopkins University
  ~
  ~ 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
  ~
  ~     http://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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.eclipse.pass</groupId>
    <artifactId>pass-support</artifactId>
    <version>1.4.0</version>
  </parent>

  <artifactId>pass-grant-loader</artifactId>

  <properties>
    <spring-boot-maven-plugin.version>3.2.1</spring-boot-maven-plugin.version>
    <awsspring.version>3.1.0</awsspring.version>
    <args4j.version>2.33</args4j.version>
    <commons.csv.version>1.10.0</commons.csv.version>
    <commons-lang.version>3.14.0</commons-lang.version>
    <ojdbc10.version>19.18.0.0</ojdbc10.version>
    <lombok.version>1.18.30</lombok.version>
    <slf4j.version>2.0.9</slf4j.version>
    <logback.version>1.4.14</logback.version>
    <junit.jupiter.version>5.10.1</junit.jupiter.version>
    <mockito.version>5.10.0</mockito.version>
    <mockito-inline.version>5.2.0</mockito-inline.version>
    <testcontainers.version>1.19.4</testcontainers.version>
    <maven-model.version>3.9.6</maven-model.version>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>${spring-boot-maven-plugin.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>io.awspring.cloud</groupId>
        <artifactId>spring-cloud-aws-dependencies</artifactId>
        <version>${awsspring.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

    <dependencies>
      <dependency>
        <groupId>org.eclipse.pass</groupId>
        <artifactId>pass-data-client</artifactId>
        <version>${project.version}</version>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter</artifactId>
      </dependency>
      <dependency>
        <groupId>io.awspring.cloud</groupId>
        <artifactId>spring-cloud-aws-starter-s3</artifactId>
        <exclusions>
          <exclusion>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
          </exclusion>
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>args4j</groupId>
        <artifactId>args4j</artifactId>
        <version>${args4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-csv</artifactId>
        <version>${commons.csv.version}</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>${commons-lang.version}</version>
      </dependency>
      <dependency>
        <groupId>com.oracle.database.jdbc</groupId>
        <artifactId>ojdbc10</artifactId>
        <version>${ojdbc10.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${slf4j.version}</version>
      </dependency>
      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>${logback.version}</version>
      </dependency>
      <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>${lombok.version}</version>
        <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${junit.jupiter.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>${mockito.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-inline</artifactId>
        <version>${mockito-inline.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>${testcontainers.version}</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.testcontainers</groupId>
        <artifactId>localstack</artifactId>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-model</artifactId>
        <version>${maven-model.version}</version>
        <scope>test</scope>
      </dependency>
    </dependencies>

  <build>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>io.fabric8</groupId>
          <artifactId>docker-maven-plugin</artifactId>
          <executions>
            <execution>
              <id>build-after-its</id>
              <phase>post-integration-test</phase>
              <configuration>
                <images>
                  <image>
                    <name>ghcr.io/eclipse-pass/jhu-grant-loader:%v</name>
                  </image>
                </images>
              </configuration>
              <goals>
                <goal>build</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-maven-plugin</artifactId>
          <version>${spring-boot-maven-plugin.version}</version>
          <configuration>
            <mainClass>org.eclipse.pass.support.grant.GrantLoaderCLI</mainClass>
            <finalName>jhu-grant-loader</finalName>
            <classifier>exec</classifier>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>repackage</goal>
              </goals>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <executions>
            <execution>
              <id>enforce-dependency-convergence</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <dependencyConvergence>
                    <excludes>
                      <exclude>com.squareup.okio:okio:*</exclude>
                      <exclude>org.jetbrains.kotlin:kotlin-stdlib-jdk8:*</exclude>
                      <!-- TODO try removing -->
                      <exclude>org.apache.commons:commons-lang3:*</exclude>
                    </excludes>
                  </dependencyConvergence>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>analyze-dependencies</id>
              <goals>
                <goal>analyze-only</goal>
              </goals>
              <phase>test-compile</phase>
              <configuration>
                <failOnWarning>true</failOnWarning>
                <ignoredDependencies>
                  <!-- These come from bundled jars -->
                  <ignoredDependency>org.springframework*::</ignoredDependency>
                </ignoredDependencies>
                <ignoredUsedUndeclaredDependencies>
                  <!-- These come from junit-jupiter, so version is tied to that direct dependency -->
                  <ignoredUsedUndeclaredDependency>org.junit.jupiter:junit-jupiter-api:</ignoredUsedUndeclaredDependency>
                  <!-- These come from testcontainers junit-jupiter -->
                  <ignoredUsedUndeclaredDependency>org.testcontainers::</ignoredUsedUndeclaredDependency>
                </ignoredUsedUndeclaredDependencies>
                <ignoredUnusedDeclaredDependencies>
                  <!-- junit-jupiter is a module containing the junit api jars used directly -->
                  <ignoredUnusedDeclaredDependency>org.junit.jupiter:junit-jupiter:</ignoredUnusedDeclaredDependency>
                  <!-- slf4j is the API used in the code, logback is the logging provider not used directly -->
                  <ignoredUnusedDeclaredDependency>ch.qos.logback:logback-classic:</ignoredUnusedDeclaredDependency>
                  <!-- slf4j is the API used in the code, jcl is used by a transitive dep -->
                  <ignoredUnusedDeclaredDependency>org.slf4j:jcl-over-slf4j:</ignoredUnusedDeclaredDependency>
                  <!-- This is used for resources in S3 -->
                  <ignoredUnusedDeclaredDependency>io.awspring.cloud:spring-cloud-aws-starter-s3:</ignoredUnusedDeclaredDependency>
                  <!-- Deficiency of analyzer bytecode -->
                  <ignoredUnusedDeclaredDependency>org.projectlombok:lombok:</ignoredUnusedDeclaredDependency>
                  <ignoredUnusedDeclaredDependency>org.mockito:mockito-inline:</ignoredUnusedDeclaredDependency>
                  <ignoredUnusedDeclaredDependency>com.oracle.database.jdbc::</ignoredUnusedDeclaredDependency>
                </ignoredUnusedDeclaredDependencies>
              </configuration>
            </execution>
          </executions>
        </plugin>

      </plugins>
  </build>
</project>
