<?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.3</version>

    <packaging>pom</packaging>

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

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

        <junit-jupiter.version>5.11.2</junit-jupiter.version>
    </properties>

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

    <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-surefire-plugin</artifactId>
                    <version>3.5.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>3.5.1</version>
                    <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.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.20.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.10.1</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.7.0</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>4.0.0.4121</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.17.0</version>
                    <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.2.1</version>
                        </dependency>
                    </dependencies>
                    <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>
                </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>
            </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>

    <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.4.0</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.26.3</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>4.6.0</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <scm>
        <url>https://github.com/mthmulders/puml-maven-plugin</url>
        <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.3</tag>
    </scm>

    <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>
            <timezone>Europe/Amsterdam</timezone>
            <url>https://maarten.mulders.it/</url>
        </developer>
    </developers>

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

    <profiles>
        <profile>
            <id>coverage</id>
        </profile>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </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>
                        <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>
