<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>

  <groupId>ch.acanda.maven</groupId>
  <artifactId>code-analysis-maven-plugin</artifactId>
  <name>Coan - Code Analysis Maven Plugin</name>
  <version>1.4.0</version>
  <packaging>maven-plugin</packaging>

  <description>
    The Code Analysis Maven Plugin runs several static analysis tools to check
    your code for bugs, design and formatting problems.
  </description>
  <url>https://github.com/acanda/code-analysis-maven-plugin</url>

  <properties>
    <java.version>17</java.version>
    <maven.compiler.release>${java.version}</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.version>3.8.7</maven.version>
    <junit.version>5.9.2</junit.version>
    <itf.version>0.12.0</itf.version>
    <checkstyle.version>10.6.0</checkstyle.version>
    <pmd.version>6.54.0</pmd.version>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <sonar.organization>acanda</sonar.organization>
    <sonar.projectKey>acanda_code-analysis-maven-plugin</sonar.projectKey>
    <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
    <sonar.java.source>${java.version}</sonar.java.source>
    <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.coverage.jacoco.xmlReportPaths>
      ${project.build.directory}/site/jacoco/jacoco.xml,
      ${project.build.directory}/site/jacoco-it/jacoco.xml
    </sonar.coverage.jacoco.xmlReportPaths>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>net.sourceforge.pmd</groupId>
      <artifactId>pmd-dist</artifactId>
      <version>${pmd.version}</version>
      <exclusions>
        <!-- JCommander is not needed by this plugin. -->
        <exclusion>
          <groupId>com.beust</groupId>
          <artifactId>jcommander</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.puppycrawl.tools</groupId>
      <artifactId>checkstyle</artifactId>
      <version>${checkstyle.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-text</artifactId>
      <version>1.10.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.12.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.jr</groupId>
      <artifactId>jackson-jr-objects</artifactId>
      <version>2.14.2</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${maven.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.plugin-tools</groupId>
      <artifactId>maven-plugin-annotations</artifactId>
      <version>3.7.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.24</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.24.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-extension-maven</artifactId>
      <version>${itf.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-jupiter-extension</artifactId>
      <version>${itf.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.soebes.itf.jupiter.extension</groupId>
      <artifactId>itf-assertj</artifactId>
      <version>${itf.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.javacrumbs.json-unit</groupId>
      <artifactId>json-unit-assertj</artifactId>
      <version>2.36.0</version>
      <scope>test</scope>
    </dependency>
    <!-- PMD uses an older version of gson that is incompatible with json unit. -->
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.10.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
      </testResource>
      <testResource>
        <directory>src/test/resources-its</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>


    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.7.1</version>
        <executions>
          <execution>
            <id>default-descriptor</id>
            <phase>process-classes</phase>
            <configuration>
              <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
            </configuration>
          </execution>
          <execution>
            <id>help-goal</id>
            <goals>
              <goal>helpmojo</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.22.2</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
          <systemProperties>
            <maven.version>${maven.version}</maven.version>
            <maven.home>${maven.home}</maven.home>
          </systemProperties>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.soebes.itf.jupiter.extension</groupId>
        <artifactId>itf-maven-plugin</artifactId>
        <version>${itf.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>ch.acanda.maven</groupId>
        <artifactId>code-analysis-maven-plugin</artifactId>
        <version>1.3.0</version>
        <executions>
          <execution>
            <id>code-analysis</id>
            <goals>
              <goal>analyse</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.owasp</groupId>
        <artifactId>dependency-check-maven</artifactId>
        <version>8.0.2</version>
        <executions>
          <execution>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>enforce-maven</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>3.6.0</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>${java.version}</version>
                </requireJavaVersion>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>versions-maven-plugin</artifactId>
        <version>2.14.2</version>
        <configuration>
          <rulesUri>file://${project.basedir}/config/versions.xml</rulesUri>
          <processDependencyManagementTransitive>false</processDependencyManagementTransitive>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>

      <distributionManagement>
        <snapshotRepository>
          <id>ossrh</id>
          <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
      </distributionManagement>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
                <configuration>
                  <keyname>53CD43B2</keyname>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <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-javadoc-plugin</artifactId>
            <version>3.4.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <doclint>all,-missing</doclint>
                </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.13</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.5.3</version>
            <configuration>
              <autoVersionSubmodules>true</autoVersionSubmodules>
              <useReleaseProfile>false</useReleaseProfile>
              <releaseProfiles>release</releaseProfiles>
              <goals>deploy</goals>
              <tagNameFormat>release/@{project.version}</tagNameFormat>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.8</version>
            <executions>
              <execution>
                <id>run-jacoco</id>
                <goals>
                  <goal>prepare-agent</goal>
                  <goal>report</goal>
                  <goal>prepare-agent-integration</goal>
                  <goal>report-integration</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <excludes>
                <exclude>**/HelpMojo.class</exclude>
              </excludes>
              <formats>
                <format>XML</format>
              </formats>
            </configuration>
          </plugin>

        </plugins>
      </build>
    </profile>

  </profiles>

  <developers>
    <developer>
      <name>Philip Graf</name>
      <email>git@acanda.ch</email>
      <organization>Philip Graf</organization>
      <organizationUrl>https://github.com/acanda</organizationUrl>
      <roles>
        <role>Founder</role>
        <role>Maintainer</role>
      </roles>
    </developer>
  </developers>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:git@github.com:acanda/code-analysis-maven-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:acanda/code-analysis-maven-plugin.git</developerConnection>
    <url>https://github.com/acanda/code-analysis-maven-plugin.git</url>
    <tag>release/1.4.0</tag>
  </scm>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/acanda/code-analysis-maven-plugin/issues</url>
  </issueManagement>

</project>
