<?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.14</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.14</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>6.0.2</junit-jupiter.version>

    <!-- spotless:off -->
    <jacocoArgLine />
    <!-- spotless:on -->
    <pitest.format>html</pitest.format>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.17</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.27</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>com.github.valfirst</groupId>
        <artifactId>slf4j-test</artifactId>
        <version>3.0.3</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>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>5.21.0</version>
        <scope>test</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.14.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.9.0</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.4</version>
          <configuration>
            <argLine>@{jacocoArgLine}</argLine>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>3.5.4</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>
          <configuration>
            <skip>true</skip>
          </configuration>
        </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.4.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.12.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>3.3.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.9.0</version>
        </plugin>
        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>5.5.0.6356</version>
        </plugin>
        <plugin>
          <groupId>org.jacoco</groupId>
          <artifactId>jacoco-maven-plugin</artifactId>
          <version>0.8.14</version>
        </plugin>
        <plugin>
          <groupId>org.pitest</groupId>
          <artifactId>pitest-maven</artifactId>
          <version>1.22.0</version>
          <configuration>
            <avoidCallsTo>
              <avoidCallsTo>org.slf4j</avoidCallsTo>
            </avoidCallsTo>
            <excludedClasses>
              <excludedClass>*Builder</excludedClass>
            </excludedClasses>
            <outputFormats>
              <format>${pitest.format}</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.3</version>
            </dependency>
            <dependency>
              <groupId>it.mulders.stryker</groupId>
              <artifactId>pit-dashboard-reporter</artifactId>
              <version>0.3.12</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>3.6.2</version>
          <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">
                <authId>ossindex</authId>
                <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.release}</maxJdkVersion>
              </enforceBytecodeVersion>

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

              <!-- enforces the Maven version -->
              <requireMavenVersion>

                <version>[3.6.3,3.99.99)</version>
              </requireMavenVersion>
            </rules>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>extra-enforcer-rules</artifactId>
              <version>1.11.0</version>
            </dependency>
            <dependency>
              <groupId>org.sonatype.ossindex.maven</groupId>
              <artifactId>ossindex-maven-enforcer-rules</artifactId>
              <version>3.2.0</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>3.2.8</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.5.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.rat</groupId>
          <artifactId>apache-rat-plugin</artifactId>
          <version>0.17</version>
        </plugin>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>3.2.1</version>
          <configuration>
            <java>
              <palantirJavaFormat>
                <version>2.85.0</version>
              </palantirJavaFormat>
              <toggleOffOn />
            </java>
            <pom>
              <sortPom>
                <expandEmptyElements>false</expandEmptyElements>
                <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
              </sortPom>
              <toggleOffOn />
            </pom>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>check</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.sonatype.central</groupId>
          <artifactId>central-publishing-maven-plugin</artifactId>
          <version>0.10.0</version>
          <extensions>true</extensions>
          <configuration>
            <autoPublish>true</autoPublish>
            <deploymentName>${project.name} ${project.version}</deploymentName>
            <excludeArtifacts>
              <excludeArtifact>plugin-tests</excludeArtifact>
            </excludeArtifacts>
            <publishingServerId>sonatype-central-portal</publishingServerId>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration combine.children="append">
          <inputExclude>.mvn/.gitkeep</inputExclude>
        </configuration>
        <executions>
          <execution>
            <id>rat-check</id>
            <goals>
              <goal>check</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-rules</id>
            <goals>
              <goal>enforce</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>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>jar</goal>
                </goals>
                <phase>package</phase>
              </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>
    <profile>
      <id>stryker-dashboard</id>
      <activation>
        <property>
          <name>env.STRYKER_DASHBOARD_API_KEY</name>
        </property>
      </activation>
      <properties>
        <pitest.format>stryker-dashboard</pitest.format>
      </properties>
    </profile>
  </profiles>

</project>
