<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.sonarsource.java</groupId>
    <artifactId>docs</artifactId>
    <version>8.9.0-SNAPSHOT</version>
  </parent>


  <artifactId>java-custom-rules-example</artifactId>
  <packaging>sonar-plugin</packaging>

  <name>SonarQube Java :: Documentation :: Custom Rules Example</name>
  <description>Java Custom Rules Example for SonarQube</description>

  <properties>
    <jacoco.version>0.8.10</jacoco.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <!-- MAIN sources dependencies -->
    <dependency>
      <groupId>org.sonarsource.api.plugin</groupId>
      <artifactId>sonar-plugin-api</artifactId>
      <version>10.12.0.2522</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.java</groupId>
      <artifactId>sonar-java-plugin</artifactId>
      <type>sonar-plugin</type>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-analyzer-commons</artifactId>
    </dependency>

    <!-- TEST sources dependencies -->
    <dependency>
      <groupId>org.sonarsource.api.plugin</groupId>
      <artifactId>sonar-plugin-api-test-fixtures</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.sonarsource.java</groupId>
      <artifactId>java-checks-testkit</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-migrationsupport</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
        <artifactId>sonar-packaging-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <pluginKey>java-custom</pluginKey>
          <pluginName>Java Custom Rules</pluginName>
          <pluginClass>org.sonar.samples.java.MyJavaRulesPlugin</pluginClass>
          <sonarLintSupported>true</sonarLintSupported>
          <skipDependenciesPackaging>true</skipDependenciesPackaging>
          <pluginApiMinVersion>9.14.0.375</pluginApiMinVersion>
          <requirePlugins>java:${project.version}</requirePlugins>
          <requiredForLanguages>java</requiredForLanguages>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <configuration>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>17</source>
          <target>17</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>prepare-agent</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>report</id>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- only required to run UT - these are UT dependencies -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy</id>
            <phase>test-compile</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.slf4j</groupId>
                  <artifactId>slf4j-api</artifactId>
                  <version>1.7.30</version>
                  <type>jar</type>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.commons</groupId>
                  <artifactId>commons-collections4</artifactId>
                  <version>4.0</version>
                  <type>jar</type>
                </artifactItem>
                <artifactItem>
                  <groupId>javax</groupId>
                  <artifactId>javaee-api</artifactId>
                  <version>6.0</version>
                  <type>jar</type>
                </artifactItem>
                <artifactItem>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-webmvc</artifactId>
                  <version>4.3.3.RELEASE</version>
                  <type>jar</type>
                </artifactItem>
                <artifactItem>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-web</artifactId>
                  <version>4.3.3.RELEASE</version>
                  <type>jar</type>
                </artifactItem>
                <artifactItem>
                  <groupId>org.springframework</groupId>
                  <artifactId>spring-context</artifactId>
                  <version>4.3.3.RELEASE</version>
                  <type>jar</type>
                </artifactItem>
                <artifactItem>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.13.2</version>
                  <type>jar</type>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.build.directory}/test-jars</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.mycila</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <configuration>
          <licenseSets>
            <licenseSet>
              <header>${project.basedir}/src/main/resources/license-header.txt</header>
            </licenseSet>
          </licenseSets>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
