<?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>

    <parent>
        <groupId>com.atlassian.pom</groupId>
        <artifactId>public-pom</artifactId>
        <version>6.3.8</version>
        <relativePath />
    </parent>

    <groupId>com.atlassian</groupId>
    <artifactId>atlassian-localhost</artifactId>
    <version>1.2.8</version>

    <name>Atlassian Localhost</name>
    <description>
        Provides library method(s) for establishing the fully-qualified hostname (FQHN)
        of the local machine. Created to shim the slightly changed behaviour of
        java.net.InetAddress.getLocalHost().getHostName() in java8 compared to java7.
    </description>

    <properties>
        <!-- atlassian-localhost:1.2.x is also used by Platform 6, hence we need to maintain Java 8 compatibility -->
        <!-- compiler source and target are inherited from the parent POM but adding them here explicitly -->
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>

        <junit.version>4.13.2</junit.version>
        <!-- Mockito 4.x is the latest which supports Java 8 -->
        <mockito.artifactId>mockito-inline</mockito.artifactId>
        <mockito.version>4.11.0</mockito.version>
        <jvm.opens />
    </properties>

    <dependencies>
        <!-- test-only deps -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!-- with Mockito 4.x, static mocks are only supported by Mockito's inline mock maker, can be changed to mockito-core after upgrade to Mockito 5.x -->
            <groupId>org.mockito</groupId>
            <artifactId>${mockito.artifactId}</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>${jvm.opens}</argLine>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>jvm-opens-activation</id>
            <activation>
                <jdk>[17,)</jdk>
            </activation>
            <properties>
                <jvm.opens>--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED</jvm.opens>
            </properties>
        </profile>
        <profile>
            <!-- https://javadoc.io/static/org.mockito/mockito-core/5.23.0/org.mockito/org/mockito/Mockito.html#0.3 -->
            <id>mockito-with-java-21</id>
            <activation>
                <jdk>[21,)</jdk>
            </activation>
            <properties>
                <mockito.artifactId>mockito-core</mockito.artifactId>
                <mockito.version>5.23.0</mockito.version>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>properties</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>${jvm.opens} -javaagent:${org.mockito:mockito-core:jar}</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <scm>
        <connection>scm:git:git@bitbucket.org:atlassian/dc-platform.git</connection>
        <developerConnection>scm:git:git@bitbucket.org:atlassian/dc-platform.git</developerConnection>
        <tag>atlassian-localhost-1.2.8</tag>
    </scm>
    <licenses>
        <license>
            <name>BSD License</name>
            <url>https://opensource.org/licenses/BSD-3-Clause</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
</project>
