<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.jenkins-ci.plugins</groupId>
    <artifactId>plugin</artifactId>
    <version>4.55</version>
    <relativePath />
  </parent>

  <groupId>org.jvnet.hudson.plugins</groupId>
  <artifactId>analysis-pom</artifactId>
  <packaging>pom</packaging>
  <name>Analysis Plug-ins Parent POM</name>
  <version>6.2.0</version>

  <url>https://github.com/jenkinsci/analysis-pom-plugin</url>
  <description>This static analysis POM serves as parent POM for all my Jenkins Plugins. It basically enhances the
    Parent POM for Jenkins Plugins (see https://github.com/jenkinsci/plugin-pom) with a predefined configuration of
    several static analysis tools. Additionally, it provides a fix set of test dependencies that are common
    to all my plugins. This POM enforces the Java style guide (see https://github.com/uhafner/codingstyle) that I am
    using in these plugins (and in my lectures at the Munich University of Applied Sciences).
  </description>

  <properties>
    <jenkins.baseline>2.387</jenkins.baseline>
    <jenkins.version>${jenkins.baseline}.1</jenkins.version>
    <spotbugs.failOnError>false</spotbugs.failOnError>
    <codingstyle.config.version>3.12.0</codingstyle.config.version>

    <!-- Test Library Dependencies Versions -->
    <equalsverifier.version>3.14</equalsverifier.version>
    <junit.version>5.9.2</junit.version>
    <junit-pioneer.version>2.0.0</junit-pioneer.version>
    <mockito.version>5.1.1</mockito.version>
    <assertj.version>3.24.2</assertj.version>
    <archunit.version>1.0.1</archunit.version>
    <json-unit-fluent.version>2.36.1</json-unit-fluent.version>

    <!-- Maven plug-in versions -->
    <spotbugs-maven-plugin.version>4.7.3.2</spotbugs-maven-plugin.version>
    <spotbugs.version>4.7.3</spotbugs.version>
    <pmd.version>6.55.0</pmd.version>
    <maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
    <checkstyle.version>10.8.0</checkstyle.version>
    <maven-pmd-plugin.version>3.20.0</maven-pmd-plugin.version>
    <findsecbugs-plugin.version>1.12.0</findsecbugs-plugin.version>
    <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
    <maven-surefire.plugin>3.0.0-M9</maven-surefire.plugin>
    <maven-failsafe.plugin>3.0.0-M9</maven-failsafe.plugin>
    <maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
    <maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
    <maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version>
    <maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
    <pitest-maven.plugin>1.11.4</pitest-maven.plugin>
    <pitest-maven.junit5.plugin>1.1.2</pitest-maven.junit5.plugin>
    <revapi-maven-plugin.version>0.15.0</revapi-maven-plugin.version>
    <revapi-java.version>0.28.0</revapi-java.version>
    <revapi-reporter-json-version>0.5.0</revapi-reporter-json-version>
    <assertj-assertions-generator-maven-plugin.version>2.2.0</assertj-assertions-generator-maven-plugin.version>
    <animal-sniffer-maven-plugin.version>1.18</animal-sniffer-maven-plugin.version>
    <maven-release-plugin.version>2.5.3</maven-release-plugin.version>

  </properties>

  <licenses>
    <license>
      <name>MIT license</name>
      <comments>All source code is under the MIT license.</comments>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Ullrich Hafner</name>
      <id>uhafner</id>
      <email>ullrich.hafner@gmail.com</email>
    </developer>
  </developers>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.jenkins.tools.bom</groupId>
        <artifactId>bom-${jenkins.baseline}.x</artifactId>
        <version>1887.vda_d0ddb_c15c4</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-bom</artifactId>
        <version>${mockito.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!-- Project Dependencies -->
    <dependency>
      <groupId>io.jenkins.plugins</groupId>
      <artifactId>commons-lang3-api</artifactId>
    </dependency>
    <dependency>
      <groupId>io.jenkins.plugins</groupId>
      <artifactId>commons-text-api</artifactId>
    </dependency>

    <!-- Test Dependencies -->
    <dependency>
      <groupId>nl.jqno.equalsverifier</groupId>
      <artifactId>equalsverifier</artifactId>
      <version>${equalsverifier.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.vintage</groupId>
      <artifactId>junit-vintage-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.platform</groupId>
      <artifactId>junit-platform-launcher</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit-pioneer</groupId>
      <artifactId>junit-pioneer</artifactId>
      <version>${junit-pioneer.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-inline</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>${assertj.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.tngtech.archunit</groupId>
      <artifactId>archunit-junit5</artifactId>
      <version>${archunit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>net.javacrumbs.json-unit</groupId>
      <artifactId>json-unit-assertj</artifactId>
      <version>${json-unit-fluent.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.ow2.asm</groupId>
          <artifactId>asm</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>display-info</id>
            <configuration>
              <rules>
                <requireUpperBoundDeps>
                  <level>WARN</level>
                </requireUpperBoundDeps>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>${maven-release-plugin.version}</version>
        <configuration>
          <tagNameFormat>v@{project.version}</tagNameFormat>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <compilerArgs>
            <arg>-Xlint:all</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Built-By>Ullrich Hafner</Built-By>
              <Url>${project.scm.url}</Url>
            </manifestEntries>
          </archive>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <includes>
                <include>**/*Assert*</include>
                <include>**/*PageObject*</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>${maven-surefire.plugin}</version>
        <configuration>
          <trimStackTrace>false</trimStackTrace> <!-- SUREFIRE-1798 -->
          <excludes>
            <exclude>**/*ITest.*</exclude>
            <exclude>**/InjectedTest.*</exclude>
          </excludes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.tngtech.archunit</groupId>
            <artifactId>archunit-junit5-engine</artifactId>
            <version>${archunit.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>${maven-failsafe.plugin}</version>
        <configuration>
          <includes>
            <include>**/*ITest.*</include>
            <include>**/*InjectedTest.*</include>
          </includes>
          <reuseForks>false</reuseForks>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>${maven-javadoc-plugin.version}</version>
        <configuration>
          <additionalOptions>-Xdoclint:all</additionalOptions>
          <failOnWarnings>false</failOnWarnings>
          <quiet>true</quiet>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>javadoc</goal>
            </goals>
            <!-- As soon as possible but after required generate-sources phase -->
            <phase>process-sources</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>${pitest-maven.plugin}</version>
        <dependencies>
          <dependency>
            <groupId>org.pitest</groupId>
            <artifactId>pitest-junit5-plugin</artifactId>
            <version>${pitest-maven.junit5.plugin}</version>
          </dependency>
        </dependencies>
        <configuration>
          <outputFormats>XML,HTML</outputFormats>
          <verbose>true</verbose>
          <targetClasses>
            <param>io.jenkins.plugins.*</param>
          </targetClasses>
          <targetTests>
            <param>io.jenkins.plugins.*</param>
          </targetTests>
          <excludedTestClasses>
            <param>*Assert</param>
            <param>*Assertions</param>
            <param>*ArchitectureTest</param>
            <param>*ITest</param>
            <param>*jmh_generated*</param>
          </excludedTestClasses>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
        <executions>
          <execution>
            <id>run-checkstyle</id>
            <goals>
              <goal>checkstyle</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
        <configuration>
          <linkXRef>false</linkXRef>
          <failOnViolation>false</failOnViolation>
          <configLocation>checkstyle-configuration.xml</configLocation>
          <includeTestSourceDirectory>true</includeTestSourceDirectory>
          <excludes>**/*Assert*.java,**/InjectedTest.java,**/Messages.java,**/*_jmh*</excludes>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>com.puppycrawl.tools</groupId>
            <artifactId>checkstyle</artifactId>
            <version>${checkstyle.version}</version>
          </dependency>
          <dependency>
            <groupId>edu.hm.hafner</groupId>
            <artifactId>codingstyle</artifactId>
            <version>${codingstyle.config.version}</version>
            <classifier>config</classifier>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>${maven-pmd-plugin.version}</version>
        <executions>
          <execution>
            <id>run-pmd</id>
            <goals>
              <goal>pmd</goal>
              <goal>cpd</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
        <configuration>
          <linkXRef>false</linkXRef>
          <rulesets>
            <ruleset>pmd-configuration.xml</ruleset>
          </rulesets>
          <excludeRoots>
            <excludeRoot>target/generated-sources/localizer</excludeRoot>
            <excludeRoot>target/generated-test-sources/test-annotations</excludeRoot>
            <excludeRoot>target/generated-test-sources/assertj-assertions</excludeRoot>
          </excludeRoots>
          <excludes>
            <exclude>**/InjectedTest.java</exclude>
          </excludes>
          <includeTests>true</includeTests>
          <minimumTokens>50</minimumTokens>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>pmd-core</artifactId>
            <version>${pmd.version}</version>
          </dependency>
          <dependency>
            <groupId>net.sourceforge.pmd</groupId>
            <artifactId>pmd-java</artifactId>
            <version>${pmd.version}</version>
          </dependency>
          <dependency>
            <groupId>edu.hm.hafner</groupId>
            <artifactId>codingstyle</artifactId>
            <version>${codingstyle.config.version}</version>
            <classifier>config</classifier>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>run-spotbugs</id>
            <goals>
              <goal>spotbugs</goal>
            </goals>
            <phase>verify</phase>
          </execution>
          <execution>
            <id>spotbugs</id>
            <phase>none</phase>
          </execution>
        </executions>
        <configuration>
          <failOnError>false</failOnError>
          <xmlOutput>true</xmlOutput>
          <threshold>Low</threshold>
          <effort>Max</effort>
          <relaxed>false</relaxed>
          <fork>true</fork>
          <excludeFilterFile>spotbugs-exclusion-filter.xml</excludeFilterFile>
          <includeTests>true</includeTests>
          <plugins>
            <plugin>
              <groupId>com.h3xstream.findsecbugs</groupId>
              <artifactId>findsecbugs-plugin</artifactId>
              <version>${findsecbugs-plugin.version}</version>
            </plugin>
          </plugins>
        </configuration>
        <dependencies>
          <dependency>
            <groupId>edu.hm.hafner</groupId>
            <artifactId>codingstyle</artifactId>
            <version>${codingstyle.config.version}</version>
            <classifier>config</classifier>
          </dependency>
          <dependency>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs</artifactId>
            <version>${spotbugs.version}</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <configuration>
          <includes>
            <include>io/jenkins/plugins/**/*</include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
            <phase>process-test-classes</phase>
          </execution>
          <execution>
            <id>report</id>
            <phase>verify</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <version>${revapi-maven-plugin.version}</version>
        <dependencies>
          <dependency>
            <groupId>org.revapi</groupId>
            <artifactId>revapi-java</artifactId>
            <version>${revapi-java.version}</version>
          </dependency>
          <dependency>
            <groupId>org.revapi</groupId>
            <artifactId>revapi-reporter-json</artifactId>
            <version>${revapi-reporter-json-version}</version>
          </dependency>
          <dependency>
            <groupId>io.jenkins.tools</groupId>
            <artifactId>revapi-hpi-extractor</artifactId>
            <version>1.0.1</version>
          </dependency>
        </dependencies>
        <configuration>
          <versionFormat>[-0-9.]*</versionFormat>
          <failBuildOnProblemsFound>true</failBuildOnProblemsFound>
          <pipelineConfiguration>
            <transformBlocks>
              <block>
                <item>manually-vetted</item>
                <item>revapi.versions</item>
              </block>
            </transformBlocks>
          </pipelineConfiguration>
          <analysisConfiguration>
            <revapi.differences id="manually-vetted">
              <attachments>
                <vetted>ok</vetted>
              </attachments>
              <differences>
                <item>
                  <ignore>true</ignore>
                  <regex>true</regex>
                  <code>java.annotation.*</code>
                  <annotationType>edu.umd.cs.findbugs.annotations.*</annotationType>
                  <justification>Annotation should be safe to change</justification>
                </item>
              </differences>
            </revapi.differences>
            <revapi.versions>
              <enabled>true</enabled>
              <strictSemver>false</strictSemver>
            </revapi.versions>
            <revapi.filter>
              <elements>
                <exclude>
                  <item>
                    <matcher>java-package</matcher>
                    <match>/org\.jvnet(\..*)?/</match>
                  </item>
                  <item>
                    <matcher>java-package</matcher>
                    <match>/net\.sf\.json(\..*)?/</match>
                  </item>
                  <item>
                    <matcher>java-package</matcher>
                    <match>/hudson(\..*)?/</match>
                  </item>
                  <item>
                    <matcher>java-package</matcher>
                    <match>/org.kohsuke(\..*)?/</match>
                  </item>
                </exclude>
              </elements>
            </revapi.filter>
            <revapi.reporter.json>
              <minSeverity>NON_BREAKING</minSeverity>
              <minCriticality>documented</minCriticality>
              <output>${project.build.outputDirectory}/revapi-result.json</output>
              <indent>false</indent>
              <append>false</append>
              <keepEmptyFile>true</keepEmptyFile>
            </revapi.reporter.json>
          </analysisConfiguration>
        </configuration>
        <executions>
          <execution>
            <id>run-revapi</id>
            <goals>
              <goal>check</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.assertj</groupId>
          <artifactId>assertj-assertions-generator-maven-plugin</artifactId>
          <version>${assertj-assertions-generator-maven-plugin.version}</version>
          <executions>
            <execution>
              <goals>
                <goal>generate-assertions</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <excludes>
              <exclude>.*ITest</exclude>
              <exclude>.*Action</exclude>
            </excludes>
            <cleanTargetDir>true</cleanTargetDir>
            <hierarchical>false</hierarchical>
            <generateBddAssertions>false</generateBddAssertions>
            <generateJUnitSoftAssertions>false</generateJUnitSoftAssertions>
            <quiet>true</quiet>
            <templates>
              <templatesDirectory>${project.basedir}/etc/assertj-templates/</templatesDirectory>
              <assertionsEntryPointClass>assertions_entry_point_class_template.txt</assertionsEntryPointClass>
              <softEntryPointAssertionClass>soft_assertions_entry_point_class_template.txt
              </softEntryPointAssertionClass>
              <objectAssertion>has_assertion_template.txt</objectAssertion>
            </templates>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>${maven-dependency-plugin.version}</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>${maven-resources-plugin.version}</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
      <id>skip</id>
      <properties>
        <maven.javadoc.skip>true</maven.javadoc.skip>
        <pmd.skip>true</pmd.skip>
        <spotbugs.skip>true</spotbugs.skip>
        <checkstyle.skip>true</checkstyle.skip>
        <skipTests>true</skipTests>
        <skipITs>true</skipITs>
        <revapi.skip>true</revapi.skip>
        <enforcer.skip>true</enforcer.skip>
      </properties>
    </profile>
    <profile>
      <id>benchmark</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <excludes>
                <exclude>**/*Test.java</exclude>
              </excludes>
              <includes>
                <include>**/*Benchmark.java</include>
              </includes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <scm>
    <connection>scm:git:https://github.com/jenkinsci/${project.artifactId}-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:jenkinsci/${project.artifactId}-plugin.git</developerConnection>
    <url>https://github.com/jenkinsci/${project.artifactId}-plugin</url>
    <tag>v6.2.0</tag>
  </scm>

  <repositories>
    <repository>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>repo.jenkins-ci.org</id>
      <url>https://repo.jenkins-ci.org/public/</url>
    </pluginRepository>
  </pluginRepositories>

</project>

