<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2013-2021 the original author or authors.
  ~
  ~ 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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.cloudfoundry</groupId>
    <artifactId>cloudfoundry-java-client</artifactId>
    <name>Cloud Foundry Java Client Parent</name>
    <description>A Java language binding for interacting with a Cloud Foundry instance</description>
    <version>5.14.0.RELEASE</version>
    <packaging>pom</packaging>
    <url>https://github.com/cloudfoundry/cf-java-client</url>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/cloudfoundry/cf-java-client</url>
    </scm>

    <developers>
        <developer>
            <name>VMware</name>
            <email>info@vmware.com</email>
            <organization>VMware, Inc.</organization>
            <organizationUrl>https://www.cloudfoundry.org</organizationUrl>
        </developer>
    </developers>

    <modules>
        <module>cloudfoundry-client</module>
        <module>cloudfoundry-client-reactor</module>
        <module>cloudfoundry-operations</module>
        <module>cloudfoundry-util</module>
    </modules>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <dependencies.version>2.7.17</dependencies.version>

        <commons-compress.version>1.27.1</commons-compress.version>
        <commons-lang3.version>3.13.0</commons-lang3.version>
        <evo-inflector.version>1.3</evo-inflector.version>
        <immutables.version>2.10.1</immutables.version>
        <jackson.version>2.16.1</jackson.version>
        <java-semver.version>0.10.2</java-semver.version>
        <jjwt.version>0.12.6</jjwt.version>
        <junit-jupiter.version>5.10.1</junit-jupiter.version>
        <mockito.version>5.8.0</mockito.version>
        <snakeyaml.version>2.2</snakeyaml.version>
        <wire.version>3.7.1</wire.version>
        <wire.plugin.version>3.0.2</wire.plugin.version>
        <wire.suffix></wire.suffix>
        <spotless.version>2.44.4</spotless.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${dependencies.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>com.github.zafarkhaja</groupId>
                <artifactId>java-semver</artifactId>
                <version>${java-semver.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.wire</groupId>
                <artifactId>wire-runtime</artifactId>
                <version>${wire.version}</version>
            </dependency>
            <dependency>
                <groupId>com.squareup.wire</groupId>
                <artifactId>wire-runtime-jvm</artifactId>
                <version>${wire.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-api</artifactId>
                <version>${jjwt.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-impl</artifactId>
                <version>${jjwt.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-jackson</artifactId>
                <version>${jjwt.version}</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-compress</artifactId>
                <version>${commons-compress.version}</version>
            </dependency>
            <dependency>
                <groupId>org.atteo</groupId>
                <artifactId>evo-inflector</artifactId>
                <version>${evo-inflector.version}</version>
            </dependency>
            <dependency>
                <groupId>org.immutables</groupId>
                <artifactId>value</artifactId>
                <version>${immutables.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.squareup.wire</groupId>
                    <artifactId>wire-maven-plugin</artifactId>
                    <version>${wire.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>generate-sources</phase>
                            <goals>
                                <goal>generate-sources</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.14.0</version>
                    <configuration>
                        <compilerArgs>
                            <arg>-Xlint:all</arg>
                            <arg>-Xlint:-options</arg>
                            <arg>-Xlint:-processing</arg>
                            <arg>-Xlint:-serial</arg>
                        </compilerArgs>
                        <showWarnings>true</showWarnings>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.4.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.4</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.2</version>
                    <configuration>
                        <links>
                            <link>https://projectreactor.io/docs/core/release/api/</link>
                        </links>
                        <quiet>true</quiet>
                        <source>8</source>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <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</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.3</version>
                    <configuration>
                        <runOrder>random</runOrder>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.jfrog.buildinfo</groupId>
                <artifactId>artifactory-maven-plugin</artifactId>
                <version>3.7.0</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>build-info</id>
                        <goals>
                            <goal>publish</goal>
                        </goals>
                        <configuration>
                            <publisher>
                                <contextUrl>https://repo.spring.io</contextUrl>
                                <username>{{ARTIFACTORY_USERNAME}}</username>
                                <password>{{ARTIFACTORY_PASSWORD}}</password>
                                <repoKey>{{ARTIFACTORY_REPO_KEY|"libs-release-local"}}</repoKey>
                                <snapshotRepoKey>{{ARTIFACTORY_SNAPSHOT_REPO_KEY|"libs-snapshot-local"}}</snapshotRepoKey>
                                <excludePatterns>*-tests.jar</excludePatterns>
                            </publisher>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>3.2.7</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                        <configuration>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless.version}</version>
                <configuration>
                    <java>
                        <excludes>
                            <exclude>**/_*.java</exclude>
                        </excludes>
                        <googleJavaFormat>
                            <version>1.19.1</version>
                            <style>AOSP</style>
                            <reflowLongStrings>true</reflowLongStrings>
                            <formatJavadoc>false</formatJavadoc>
                        </googleJavaFormat>
                        <removeUnusedImports />
                    </java>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <pluginRepositories>
        <pluginRepository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>jfrog-jars</id>
            <name>jfrog-jars</name>
            <url>https://oss.jfrog.org/artifactory/jfrog-jars/</url>
        </pluginRepository>
    </pluginRepositories>

    <profiles>
        <profile>
            <id>integration-test</id>

            <modules>
                <module>integration-test</module>
            </modules>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>test-logcache</id>

            <modules>
                <module>test-log-cache</module>
            </modules>
        </profile>
        <profile>
            <id>test-service-broker</id>

            <modules>
                <module>test-service-broker</module>
            </modules>
        </profile>

        <profile>
            <id>jdk-17</id>
            <activation>
                <jdk>17</jdk>
            </activation>
            <properties>
                <java.version>17</java.version>
                <dependencies.version>3.2.1</dependencies.version>
                <wire.version>4.9.1</wire.version>
                <wire.plugin.version>3.0.2</wire.plugin.version>
                <wire.suffix>-jvm</wire.suffix>
            </properties>
            <build>
                <finalName>${project.artifactId}-jdk17-${project.version}</finalName>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <!-- @see https://github.com/immutables/immutables/issues/1339#issuecomment-1016125673 -->
                        <configuration>
                            <fork>true</fork>
                            <compilerArgs combine.children="append">
                                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                            </compilerArgs>
                            <showWarnings>true</showWarnings>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>jdk-21</id>
            <activation>
                <jdk>21</jdk>
            </activation>
            <properties>
                <java.version>21</java.version>
                <dependencies.version>3.2.1</dependencies.version>
                <wire.version>4.9.1</wire.version>
                <wire.plugin.version>3.0.2</wire.plugin.version>
                <wire.suffix>-jvm</wire.suffix>
            </properties>
            <build>
                <finalName>${project.artifactId}-jdk21-${project.version}</finalName>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <!-- @see https://github.com/immutables/immutables/issues/1339#issuecomment-1016125673 -->
                        <configuration>
                            <fork>true</fork>
                            <compilerArgs combine.children="append">
                                <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
                            </compilerArgs>
                            <showWarnings>true</showWarnings>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
