<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright 2020 Maarten Mulders

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<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>it.mulders.puml</groupId>
  <artifactId>puml-parent</artifactId>
  <version>0.4.1</version>

  <packaging>pom</packaging>

  <name>PlantUML Maven Plugin :: Parent</name>
  <description>Maven Plugin for generating diagrams from PlantUML sources</description>
  <url>https://github.com/mthmulders/puml-maven-plugin</url>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <id>mthmulders</id>
      <name>Maarten Mulders</name>
      <url>https://maarten.mulders.it/</url>
      <timezone>Europe/Amsterdam</timezone>
    </developer>
  </developers>

  <modules>
    <module>maven-plugin</module>
    <module>plantuml-api</module>
    <module>plantuml-v1-adapter</module>
    <module>tests</module>
  </modules>

  <scm>
    <connection>scm:git:https://github.com/mthmulders/puml-maven-plugin.git</connection>
    <developerConnection>scm:git:git@github.com:mthmulders/puml-maven-plugin.git</developerConnection>
    <tag>v0.4.1</tag>
    <url>https://github.com/mthmulders/puml-maven-plugin</url>
  </scm>

  <distributionManagement>
    <repository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
    <snapshotRepository>
      <id>ossrh</id>
      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </snapshotRepository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>17</maven.compiler.release>

    <junit-jupiter.version>5.11.4</junit-jupiter.version>

    <!-- spotless:off -->
    <jacocoArgLine />
    <!-- spotless:on -->
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.16</version>
      </dependency>

      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>${junit-jupiter.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>

      <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.5.17</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.github.valfirst</groupId>
        <artifactId>slf4j-test</artifactId>
        <version>3.0.1</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>3.27.3</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>5.15.2</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.13.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.8.1</version>
          <executions>
            <execution>
              <goals>
                <goal>properties</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.5.2</version>
          <configuration>
            <argLine>@{jacocoArgLine}</argLine>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.5.2</version>
          <configuration>
            <argLine>@{jacocoArgLine}</argLine>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>3.1.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.21.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>3.3.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.11.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>3.1.1</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <releaseProfiles>release</releaseProfiles>
            <tagNameFormat>v@{project.version}</tagNameFormat>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>5.0.0.4389</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.12</version>
        </plugin>
        <plugin>
          <groupId>org.pitest</groupId>
          <artifactId>pitest-maven</artifactId>
          <version>1.18.1</version>
          <configuration>
            <avoidCallsTo>
              <avoidCallsTo>org.slf4j</avoidCallsTo>
            </avoidCallsTo>
            <excludedClasses>
              <excludedClass>*Builder</excludedClass>
            </excludedClasses>
            <outputFormats>
              <format>stryker-dashboard</format>
            </outputFormats>
            <pluginConfiguration>
              <stryker.moduleName>${project.artifactId}</stryker.moduleName>
            </pluginConfiguration>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.pitest</groupId>
              <artifactId>pitest-junit5-plugin</artifactId>
              <version>1.2.1</version>
            </dependency>
            <dependency>
              <groupId>it.mulders.stryker</groupId>
              <artifactId>pit-dashboard-reporter</artifactId>
              <version>0.3.1</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.5.0</version>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>1.9.0</version>
            </dependency>
            <dependency>
              <groupId>org.sonatype.ossindex.maven</groupId>
              <artifactId>ossindex-maven-enforcer-rules</artifactId>
              <version>3.2.0</version>
            </dependency>
          </dependencies>
          <executions>
            <execution>
              <id>enforce-rules</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <fail>true</fail>
                <rules>
                  <!-- checks the dependencies and fails if the groupId:artifactId combination exists in the list of direct or transitive dependencies -->
                  <banCircularDependencies />

                  <!-- checks the dependencies and fails if any class is present in more than one dependency -->
                  <banDuplicateClasses>
                    <scopes>
                      <scope>runtime</scope>
                    </scopes>
                  </banDuplicateClasses>

                  <!-- checks the dependencies and fails if any dependencies with known vulnerabilities are in use. -->
                  <banVulnerable implementation="org.sonatype.ossindex.maven.enforcer.BanVulnerableDependencies">
                    <scope>runtime</scope>
                  </banVulnerable>

                  <!-- ensure all dependencies converge to the same version -->
                  <dependencyConvergence />

                  <!-- checks the dependencies transitively and fails if any class of any dependency is having its bytecode version higher than the one specified -->
                  <enforceBytecodeVersion>
                    <maxJdkVersion>${maven.compiler.source}</maxJdkVersion>
                  </enforceBytecodeVersion>

                  <!--
                  enforces the JDK version -->
                  <requireJavaVersion>
                    <version>${maven.compiler.source}</version>
                  </requireJavaVersion>

                  <!-- enforces the Maven version -->
                  <requireMavenVersion>
                    <version>3.6.3</version>
                  </requireMavenVersion>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.2.7</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.4.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>0.16.1</version>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>2.44.2</version>
          <configuration>
            <java>
              <palantirJavaFormat>
                <version>2.50.0</version>
              </palantirJavaFormat>
              <toggleOffOn />
            </java>
            <pom>
              <sortPom>
                <expandEmptyElements>true</expandEmptyElements>
                <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
              </sortPom>
              <toggleOffOn />
            </pom>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration combine.children="append">
          <excludes>
            <exclude>.mvn/.gitkeep</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <id>rat-check</id>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>coverage</id>
    </profile>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <goals>
                  <goal>sign</goal>
                </goals>
                <phase>verify</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>sonarcloud</id>
      <properties>
        <sonar.projectKey>mthmulders_puml-maven-plugin</sonar.projectKey>
        <sonar.organization>mthmulders-github</sonar.organization>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
        <sonar.moduleKey>${project.artifactId}</sonar.moduleKey>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <configuration>
              <propertyName>jacocoArgLine</propertyName>
            </configuration>
            <executions>
              <execution>
                <id>prepare-agent</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
              </execution>
              <execution>
                <id>prepare-agent-integration</id>
                <goals>
                  <goal>prepare-agent-integration</goal>
                </goals>
              </execution>
              <execution>
                <id>report</id>
                <goals>
                  <goal>report</goal>
                </goals>
              </execution>
              <execution>
                <id>report-integration</id>
                <goals>
                  <goal>report-integration</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
