<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.28.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>21</java.version>
    <maven.compiler.release>${java.version}</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.version>3.9.12</maven.version>
    <junit.version>6.0.3</junit.version>
    <itf.version>0.13.1</itf.version>
    <checkstyle.version>13.2.0</checkstyle.version>
    <pmd.version>7.22.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>
    <!-- AbstractCoanMojo.java is tested by Maven Tests which do record coverage data. -->
    <sonar.coverage.exclusions>**/AbstractCoanMojo.java</sonar.coverage.exclusions>
  </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 and pmd-cli are not needed by this plugin. -->
        <exclusion>
          <groupId>com.beust</groupId>
          <artifactId>jcommander</artifactId>
        </exclusion>
        <exclusion>
          <groupId>net.sourceforge.pmd</groupId>
          <artifactId>pmd-cli</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.15.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.20.0</version>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.jr</groupId>
      <artifactId>jackson-jr-objects</artifactId>
      <version>2.21.1</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.15.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>1.18.42</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.27.7</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>5.1.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.wiremock</groupId>
      <artifactId>wiremock</artifactId>
      <version>3.13.2</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>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.owasp</groupId>
          <artifactId>dependency-check-maven</artifactId>
          <version>12.2.0</version>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.15.0</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>3.15.2</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>3.5.5</version>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.5.5</version>
        <configuration>
          <systemPropertyVariables>
            <maven.version>${maven.version}</maven.version>
            <maven.home>${maven.home}</maven.home>
          </systemPropertyVariables>
        </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.27.0</version>
        <executions>
          <execution>
            <id>code-analysis</id>
            <goals>
              <goal>analyse</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.6.2</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.21.0</version>
        <configuration>
          <rulesUri>file://${project.basedir}/config/versions.xml</rulesUri>
          <processDependencyManagementTransitive>false</processDependencyManagementTransitive>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <profiles>
    <profile>
      <id>dependency-check</id>

      <activation>
        <property>
          <name>env.NVD_API_KEY</name>
        </property>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <configuration>
              <nvdApiKey>${env.NVD_API_KEY}</nvdApiKey>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>dependency-check-github</id>

      <activation>
        <property>
          <name>env.CI</name>
        </property>
      </activation>

      <build>
        <plugins>
          <plugin>
            <groupId>org.owasp</groupId>
            <artifactId>dependency-check-maven</artifactId>
            <configuration>
              <dataDirectory>target/owasp/data</dataDirectory>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <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.2.8</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.4.0</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.12.0</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.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.10.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>true</autoPublish>
            </configuration>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-release-plugin</artifactId>
            <version>3.3.1</version>
            <configuration>
              <releaseProfiles>release</releaseProfiles>
              <goals>deploy</goals>
              <tagNameFormat>release/@{project.version}</tagNameFormat>
              <projectVersionPolicyId>SemVerVersionPolicy</projectVersionPolicyId>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>coverage</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.14</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.28.0</tag>
  </scm>

  <issueManagement>
    <system>Github</system>
    <url>https://github.com/acanda/code-analysis-maven-plugin/issues</url>
  </issueManagement>

</project>
