<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.rabbitmq.client</groupId>
    <artifactId>credentials</artifactId>
    <version>0.2.0</version>
    <packaging>jar</packaging>

    <name>RabbitMQ Java Credentials</name>
    <description>Credentials management utilities for the RabbitMQ Java libraries</description>
    <url>https://github.com/rabbitmq/rabbitmq-java-credentials</url>

    <licenses>
        <license>
            <name>ASL 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <email>info@rabbitmq.com</email>
            <name>Team RabbitMQ</name>
            <organization>Broadcom Inc. and its subsidiaries</organization>
            <organizationUrl>https://rabbitmq.com</organizationUrl>
        </developer>
    </developers>

    <organization>
        <name>Broadcom Inc. and/or its subsidiaries</name>
        <url>https://www.rabbitmq.com</url>
    </organization>

    <scm>
        <url>https://github.com/rabbitmq/rabbitmq-java-credentials</url>
        <connection>scm:git:git://github.com/rabbitmq/rabbitmq-java-credentials.git</connection>
        <developerConnection>scm:git:https://github.com/rabbitmq/rabbitmq-java-credentials.git</developerConnection>
        <tag>v0.2.0</tag>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <test-arguments />
        <spotless.check.skip>true</spotless.check.skip>
        <gpg.keyname>6026DFCA</gpg.keyname>

        <!-- dependencies -->
        <slf4j.version>1.7.36</slf4j.version>
        <gson.version>2.15.0</gson.version>
        <junit.jupiter.version>5.14.4</junit.jupiter.version>
        <assertj.version>3.27.7</assertj.version>
        <mockito.version>5.24.0</mockito.version>
        <bouncycastle.version>1.85</bouncycastle.version>
        <google-java-format.version>2.0.0</google-java-format.version>
        <spotbugs.version>4.10.5</spotbugs.version>

        <!-- plugins -->
        <maven-enforcer-plugin.version>3.7.0</maven-enforcer-plugin.version>
        <extra-enforcer-rules.version>1.12.1</extra-enforcer-rules.version>
        <maven-clean-plugin.version>3.5.0</maven-clean-plugin.version>
        <maven-resources-plugin.version>3.5.0</maven-resources-plugin.version>
        <maven-compiler-plugin.version>3.16.0</maven-compiler-plugin.version>
        <maven-dependency-plugin.version>3.11.0</maven-dependency-plugin.version>
        <maven-surefire-plugin.version>3.6.1</maven-surefire-plugin.version>
        <maven-jar-plugin.version>3.5.1</maven-jar-plugin.version>
        <maven-install-plugin.version>3.2.0</maven-install-plugin.version>
        <maven-deploy-plugin.version>3.2.0</maven-deploy-plugin.version>
        <maven-release-plugin.version>3.3.1</maven-release-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
        <central-publishing-maven-plugin.version>0.12.0</central-publishing-maven-plugin.version>
        <spotless.version>3.10.4</spotless.version>
        <spotbugs-maven-plugin.version>4.10.5.0</spotbugs-maven-plugin.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcpkix-jdk18on</artifactId>
            <version>${bouncycastle.version}</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${slf4j.version}</version>
            <scope>test</scope>
        </dependency>

        <!-- add explicitly to update automatically with dependabot -->
        <dependency>
            <groupId>com.google.googlejavaformat</groupId>
            <artifactId>google-java-format</artifactId>
            <version>${google-java-format.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

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

    <build>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven-enforcer-plugin.version}</version>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>extra-enforcer-rules</artifactId>
                        <version>${extra-enforcer-rules.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <version>[3.9.0,4)</version>
                                </requireMavenVersion>
                                <enforceBytecodeVersion>
                                    <maxJdkVersion>1.8</maxJdkVersion>
                                    <ignoredScopes>
                                        <ignoredScope>test</ignoredScope>
                                        <ignoredScope>provided</ignoredScope>
                                    </ignoredScopes>
                                    <ignoreClasses>
                                        <ignoreClass>module-info</ignoreClass>
                                    </ignoreClasses>
                                </enforceBytecodeVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <compilerArgs>
                        <arg>-Xlint:deprecation</arg>
                        <arg>-Xlint:unchecked</arg>
                        <arg>-Xlint:-options</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${maven-dependency-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <argLine>${test-arguments}</argLine>
                    <systemPropertyVariables>
                        <net.bytebuddy.experimental>true</net.bytebuddy.experimental>
                    </systemPropertyVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven-jar-plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>com.rabbitmq.client.credentials</Automatic-Module-Name>
                            <Implementation-Title>${project.name}</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <configuration>
                    <java>
                        <googleJavaFormat>
                            <version>${google-java-format.version}</version>
                            <style>GOOGLE</style>
                        </googleJavaFormat>
                        <removeUnusedImports />
                        <forbidWildcardImports />
                    </java>
                    <!--                  <ratchetFrom>origin/main</ratchetFrom>-->
                    <licenseHeader> <!-- specify either content or file, but not both -->
                        <content>// Copyright (c) $YEAR Broadcom. All Rights Reserved.
                            // The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
                            //
                            // 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.
                            //
                            // If you have any questions regarding licensing, please contact us at
                            // info@rabbitmq.com.
                        </content>
                    </licenseHeader>
                </configuration>
            </plugin>

        </plugins>

    </build>

    <profiles>

        <profile>
            <id>java-8</id>
            <activation>
                <jdk>1.8</jdk>
            </activation>
            <properties>
                <mockito.version>4.11.0</mockito.version>
            </properties>
        </profile>

        <profile>
            <id>java-9-and-more</id>
            <activation>
                <jdk>[9,)</jdk>
            </activation>
            <properties>
                <maven.compiler.release>8</maven.compiler.release>
            </properties>
        </profile>

        <profile>
            <id>java-11-and-more</id>
            <activation>
                <jdk>[11,)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.spotbugs</groupId>
                        <artifactId>spotbugs-maven-plugin</artifactId>
                        <version>${spotbugs-maven-plugin.version}</version>
                        <dependencies>
                            <dependency>
                                <groupId>com.github.spotbugs</groupId>
                                <artifactId>spotbugs</artifactId>
                                <version>${spotbugs.version}</version>
                            </dependency>
                        </dependencies>
                        <configuration>
                            <onlyAnalyze>com.rabbitmq.-</onlyAnalyze>
                            <excludeFilterFile>src/spotbugs/exclude.xml</excludeFilterFile>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>java-21-and-more</id>
            <activation>
                <jdk>[21,)</jdk>
            </activation>
            <properties>
                <test-arguments>-Xshare:off -javaagent:${org.mockito:mockito-core:jar}</test-arguments>
            </properties>
        </profile>

        <profile>
            <id>publish</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven-javadoc-plugin.version}</version>
                        <configuration>
                            <quiet>true</quiet>
                            <source>8</source>
                            <additionalOptions>-Xdoclint:none</additionalOptions>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>${central-publishing-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central-portal</publishingServerId>
                            <autoPublish>false</autoPublish>
                        </configuration>
                    </plugin>
                    <!-- must stay at the end to execute last -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven-gpg-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <keyname>${gpg.keyname}</keyname>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>
