<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>io.github.ci-cmg</groupId>
  <artifactId>mapbox-vector-tile</artifactId>
  <version>4.0.7</version>
  <packaging>jar</packaging>

  <name>${project.groupId}:${project.artifactId}</name>
  <description>Mapbox Vector Tile Support for Java</description>
  <url>https://github.com/CI-CMG/mapbox-vector-tile</url>

  <licenses>
    <license>
      <name>MIT License</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>CIRES Coastal and Marine Geophysics / Marine Geology and Geophysics Developers</name>
      <organization>CIRES</organization>
      <organizationUrl>https://github.com/CI-CMG</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:https://github.com/CI-CMG/mapbox-vector-tile.git</connection>
    <developerConnection>scm:git:https://github.com/CI-CMG/mapbox-vector-tile.git</developerConnection>
    <url>https://github.com/CI-CMG/mapbox-vector-tile</url>
    <tag>v4.0.7</tag>
  </scm>

  <repositories>
    <repository>
      <name>Central Portal Snapshots</name>
      <id>central-portal-snapshots</id>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </repository>
  </repositories>

  <properties>
    <maven.compiler.release>8</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <junit.jupiter.version>5.8.2</junit.jupiter.version>
    <slf4j.version>1.7.33</slf4j.version>
    <javadoc.version>3.3.1</javadoc.version>
    <jacoco.version>0.8.7</jacoco.version>
    <nvdApiKey>${env.NVD_API_KEY}</nvdApiKey>
    <ossIndexUsername>${env.OSS_INDEX_USERNAME}</ossIndexUsername>
    <ossIndexPassword>${env.OSS_INDEX_PASSWORD}</ossIndexPassword>
    <git.username />
    <git.password />
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>3.25.8</version>
    </dependency>
    <dependency>
      <groupId>org.locationtech.jts</groupId>
      <artifactId>jts-core</artifactId>
      <version>1.18.2</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <version>${junit.jupiter.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${javadoc.version}</version>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
      </plugin>
    </plugins>
  </reporting>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>${jacoco.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.9.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.1.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${javadoc.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>0.7.0</version>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central</publishingServerId>
          <autoPublish>true</autoPublish>
          <waitUntil>published</waitUntil>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>parse-version</id>
            <goals>
              <goal>parse-version</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>3.1.1</version>
        <configuration>
          <autoVersionSubmodules>true</autoVersionSubmodules>
          <useReleaseProfile>false</useReleaseProfile>
          <releaseProfiles>release,site-publish</releaseProfiles>
          <goals>deploy site</goals>
          <tagNameFormat>v@{project.version}</tagNameFormat>
          <arguments>-DskipTests -Dgit.username=${git.username} -Dgit.password=${git.password}</arguments>
          <username>${git.username}</username>
          <password>${git.password}</password>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>default-prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <phase>verify</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>4.7.3.5</version>
        <configuration>
          <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>

    <profile>
      <id>dep-check</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <version>12.1.6</version>
            <configuration>
              <failBuildOnCVSS>0</failBuildOnCVSS>
              <skipProvidedScope>true</skipProvidedScope>
              <suppressionFiles>
                <suppressionFile>owasp-dep-check-suppression.xml</suppressionFile>
              </suppressionFiles>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>release</id>
      <properties>
        <sign.skipNoKey>false</sign.skipNoKey>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>pl.project13.maven</groupId>
            <artifactId>git-commit-id-plugin</artifactId>
            <version>4.9.10</version>
            <executions>
              <execution>
                <id>get-the-git-infos</id>
                <goals>
                  <goal>revision</goal>
                </goals>
                <phase>pre-site</phase>
              </execution>
            </executions>
            <configuration>
              <injectAllReactorProjects>true</injectAllReactorProjects>
              <failOnNoGitDirectory>false</failOnNoGitDirectory>
              <offline>true</offline>
              <replacementProperties>
                <replacementProperty>
                  <property>git.remote.origin.url</property>
                  <propertyOutputSuffix>suffix</propertyOutputSuffix>
                  <token>^.+/(.+).git$</token>
                  <value>$1</value>
                  <regex>true</regex>
                </replacementProperty>
              </replacementProperties>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.simplify4u.plugins</groupId>
            <artifactId>sign-maven-plugin</artifactId>
            <version>1.1.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <skipNoKey>false</skipNoKey>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>site-publish</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
          </plugin>
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>3.1.0</version>
            <executions>
              <execution>
                <id>index.html</id>
                <phase>site</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/site-resources</outputDirectory>
                  <useDefaultDelimiters>false</useDefaultDelimiters>
                  <delimiters>
                    <delimiter>@</delimiter>
                  </delimiters>
                  <resources>
                    <resource>
                      <directory>site-resources</directory>
                      <filtering>true</filtering>
                    </resource>
                  </resources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>publish-site</id>
                <phase>site</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <delete dir="${project.build.directory}/project-documentation" quiet="true" />
                    <exec dir="${project.build.directory}" executable="git">
                      <arg value="clone" />
                      <arg value="--depth=1" />
                      <arg value="git@github.com:CI-CMG/project-documentation.git" />
                    </exec>
                    <exec dir="${project.build.directory}/project-documentation" executable="git">
                      <arg value="remote" />
                      <arg value="add" />
                      <arg value="javadoc" />
                      <arg value="git@github.com:CI-CMG/project-documentation.git" />
                    </exec>
                    <exec dir="${project.build.directory}/project-documentation" executable="git" failonerror="false">
                      <arg value="rm" />
                      <arg value="-r" />
                      <arg value="${git.remote.origin.url.suffix}/${project.version}" />
                    </exec>
                    <mkdir dir="${project.build.directory}/project-documentation/${git.remote.origin.url.suffix}" />
                    <copy todir="${project.build.directory}/project-documentation/${git.remote.origin.url.suffix}">
                      <fileset file="${project.build.directory}/site-resources/index.html" />
                    </copy>
                    <copy todir="${project.build.directory}/project-documentation/${git.remote.origin.url.suffix}/${project.version}">
                      <fileset dir="${project.build.directory}/site" />
                    </copy>
                    <exec dir="${project.build.directory}/project-documentation" executable="git">
                      <arg value="add" />
                      <arg value="${git.remote.origin.url.suffix}/index.html" />
                    </exec>
                    <exec dir="${project.build.directory}/project-documentation" executable="git">
                      <arg value="add" />
                      <arg value="${git.remote.origin.url.suffix}/${project.version}" />
                    </exec>
                    <exec dir="${project.build.directory}/project-documentation" executable="git">
                      <arg value="commit" />
                      <arg value="-m" />
                      <arg value="Update Documentation: ${git.remote.origin.url.suffix}/${project.version}" />
                    </exec>
                    <exec dir="${project.build.directory}/project-documentation" executable="git">
                      <arg value="push" />
                      <arg value="javadoc" />
                      <arg value="trunk" />
                    </exec>
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>


</project>