<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.rub.nds</groupId>
    <artifactId>relaxed-dependency-convergence-rule</artifactId>
    <version>1.0.1</version>

    <name>Relaxed Dependency Convergence Rule</name>
    <description>A custom maven enforcer rule that works similar to dependencyConvergence but is limited to contradicting major versions</description>
    <url>https://github.com/tls-attacker/relaxed-dependency-convergence-rule</url>
    <inceptionYear>2025</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>TrueSkrillor</id>
            <name>Fabian Bäumer</name>
            <email>fabian.baeumer@rub.de</email>
            <url>https://github.com/TrueSkrillor</url>
            <organization>NDS</organization>
            <organizationUrl>https://informatik.rub.de/nds/</organizationUrl>
            <roles>
                <role>Developer</role>
            </roles>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/tls-attacker/relaxed-dependency-convergence-rule.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/tls-attacker/relaxed-dependency-convergence-rule.git</developerConnection>
        <tag>v1.0.1</tag>
        <url>https://github.com/tls-attacker/relaxed-dependency-convergence-rule</url>
    </scm>

    <distributionManagement>
        <repository>
            <id>rub-nexus</id>
            <name>Nexus Internal Repository</name>
            <url>https://hydrogen.cloud.nds.rub.de/nexus/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>rub-nexus</id>
            <name>Nexus Internal Repository (SNAPSHOT)</name>
            <url>https://hydrogen.cloud.nds.rub.de/nexus/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <enforcer.api.version>3.5.0</enforcer.api.version>
        <maven.version>3.6.3</maven.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <skip.signature>true</skip.signature>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-dependency-tree</artifactId>
            <version>3.3.0</version>
        </dependency>
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.enforcer</groupId>
            <artifactId>enforcer-api</artifactId>
            <version>${enforcer.api.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Enforce maven and Java versions -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>${maven.version}</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <version>${maven.compiler.source}</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Formatting -->
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.44.5</version>
                <configuration>
                    <pom>
                        <includes>
                            <include>**/pom.xml</include>
                        </includes>
                        <sortPom>
                            <sortDependencies>scope,groupId,artifactId</sortDependencies>
                            <sortModules>true</sortModules>
                            <sortExecutions>true</sortExecutions>
                            <nrOfIndentSpace>4</nrOfIndentSpace>
                            <expandEmptyElements>false</expandEmptyElements>
                            <spaceBeforeCloseEmptyElement>true</spaceBeforeCloseEmptyElement>
                        </sortPom>
                    </pom>
                    <markdown>
                        <includes>
                            <include>**/*.md</include>
                        </includes>
                        <flexmark />
                    </markdown>
                    <java>
                        <lineEndings>GIT_ATTRIBUTES</lineEndings>
                        <trimTrailingWhitespace />
                        <endWithNewline />
                        <importOrder />
                        <removeUnusedImports />
                        <indent>
                            <spaces>true</spaces>
                            <spacesPerTab>4</spacesPerTab>
                        </indent>
                        <googleJavaFormat>
                            <version>1.27.0</version>
                            <style>AOSP</style>
                        </googleJavaFormat>
                        <licenseHeader>
                            <file>${project.basedir}/license_header_plain.txt</file>
                        </licenseHeader>
                    </java>
                </configuration>
                <executions>
                    <execution>
                        <id>format</id>
                        <goals>
                            <goal>apply</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Disable resource plugin as there are no resources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <!-- Disable resources execution as there are no resources -->
                    <execution>
                        <id>default-resources</id>
                        <phase>none</phase>
                    </execution>
                    <execution>
                        <id>default-testResources</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Compile sources -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.14.0</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
                <executions>
                    <!-- Disable testCompile execution as there are no tests -->
                    <execution>
                        <id>default-testCompile</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Generate index for the enforcer rule -->
            <plugin>
                <groupId>org.eclipse.sisu</groupId>
                <artifactId>sisu-maven-plugin</artifactId>
                <version>0.9.0.M4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>main-index</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Disable unit test plugin as there are no tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.3</version>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
            <!-- Build jar file -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.4.2</version>
            </plugin>
            <!-- Compile javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.11.2</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Pack source files to jar archive -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.3.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Install artifacts to local repository -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>3.1.4</version>
            </plugin>
            <!-- Generate PGP signature -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.2.7</version>
                <configuration>
                    <skip>${skip.signature}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <!-- Deploy artifacts to internal repository -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>3.1.4</version>
                <configuration>
                    <skip>false</skip>
                </configuration>
            </plugin>
            <!-- Release helper plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                    <scmCommentPrefix>release:</scmCommentPrefix>
                    <!--suppress UnresolvedMavenProperty -->
                    <scmReleaseCommitComment>@{prefix} @{releaseLabel}</scmReleaseCommitComment>
                    <scmDevelopmentCommitComment>@{prefix} Prepare for next development iteration</scmDevelopmentCommitComment>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Deployment to Maven Central is done by activating this profile via -P central -->
        <profile>
            <id>central</id>

            <distributionManagement>
                <repository>
                    <id>central-upload</id>
                    <name>Maven Central Repository</name>
                    <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
                <snapshotRepository>
                    <id>central-upload</id>
                    <name>Maven Central Repository (SNAPSHOT)</name>
                    <url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
                </snapshotRepository>
            </distributionManagement>

            <!-- Override default distributionManagement for Maven Central deployment -->
            <!-- Switch to Maven Central deployment -->
            <properties>
                <!-- Artifacts pushed to maven central must be signed -->
                <skip.signature>false</skip.signature>
            </properties>

            <build>
                <plugins>
                    <!-- Artifact deployment to central -->
                    <!-- Just use standard Maven deployment mechanism for Maven Central -->
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.8.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central-upload</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
