<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed under the EUPL, Version 1.2 or – as soon they will be approved by
  ~ the European Commission - subsequent versions of the EUPL (the "Licence");
  ~ You may not use this work except in compliance with the Licence.
  ~ You may obtain a copy of the Licence at:
  ~
  ~   https://joinup.ec.europa.eu/software/page/eupl
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the Licence is distributed on an "AS IS" basis,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the Licence for the specific language governing permissions and
  ~ limitations under the Licence.
  ~
  -->

<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>org.entur.ror</groupId>
        <artifactId>superpom</artifactId>
        <version>6.1.0</version>
    </parent>

    <groupId>org.entur.ror.helpers</groupId>
    <artifactId>helper</artifactId>
    <version>7.2.0</version>
    <packaging>pom</packaging>

    <name>entur-helper</name>
    <description>Shared libraries used in other route database/journey planning components</description>
    <url>https://github.com/entur/rutebanken-helpers</url>
    <inceptionYear>2016</inceptionYear>
    <organization>
        <name>Entur AS</name>
        <url>https://www.entur.org/</url>
    </organization>
    <licenses>
        <license>
            <name>EUPL-1.2 with modifications</name>
            <url>https://joinup.ec.europa.eu/software/page/eupl</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <modules>
        <module>storage</module>
        <module>storage-aws-s3</module>
        <module>storage-gcp-gcs</module>
        <module>hazelcast4-helper</module>
        <module>calendar-helper</module>
        <module>organisation</module>
        <module>slack</module>
        <module>entur-google-pubsub</module>
        <module>oauth2</module>
        <module>permission-store-proxy</module>
        <module>stopplace-changelog</module>
        <module>stopplace-changelog-starter</module>
    </modules>

    <scm>
        <connection>scm:git:ssh://git@github.com/entur/rutebanken-helpers.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/entur/rutebanken-helpers.git</developerConnection>
        <url>https://github.com/entur/rutebanken-helpers/tree/master</url>
        <tag>HEAD</tag>
    </scm>
    <properties>
        <license.licenseName>eupl-1.2</license.licenseName>
        <license.licenseResolver>${project.baseUri}/src/license</license.licenseResolver>

        <spring-cloud-gcp.version>5.11.3</spring-cloud-gcp.version>
        <!-- Kubernetes client version aligned on camel-kubernetes transitive dependency -->
        <kubernetes-client.version>7.4.0</kubernetes-client.version>
        <commons-io.version>2.18.0</commons-io.version>
        <hazelcast-kubernetes.version>2.2.3</hazelcast-kubernetes.version>
        <httpclient5.version>5.4.2</httpclient5.version>
        <hamcrest.version>3.0</hamcrest.version>
        <jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <sonar-maven-plugin.version>5.1.0.4751</sonar-maven-plugin.version>
        <prettier-java.version>2.1.0</prettier-java.version>
        <prettier-maven-plugin.version>0.22</prettier-maven-plugin.version>
        <plugin.prettier.goal>write</plugin.prettier.goal>
        <testcontainers-junit-jupiter.version>1.20.6</testcontainers-junit-jupiter.version>
        <testcontainers-gcloud.version>1.20.6</testcontainers-gcloud.version>
        <testcontainers-localstack.version>1.20.6</testcontainers-localstack.version>
        <spring-boot-loader-tools.version>4.0.4</spring-boot-loader-tools.version>

        <!-- empty argLine property, the value is set up by Jacoco during unit tests execution -->
        <argLine/>

        <jreleaser-maven-plugin.version>1.18.0</jreleaser-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>org.entur.ror.helpers</groupId>
                <artifactId>organisation</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>org.entur.ror.helpers</groupId>
                <artifactId>entur-google-pubsub</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>spring-cloud-gcp-dependencies</artifactId>
                <version>${spring-cloud-gcp.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

            <dependency>
                <groupId>com.hazelcast</groupId>
                <artifactId>hazelcast-kubernetes</artifactId>
                <version>${hazelcast-kubernetes.version}</version>
            </dependency>

            <!--See compatibility matrix https://github.com/fabric8io/kubernetes-client#compatibility-matrix -->
            <dependency>
                <groupId>io.fabric8</groupId>
                <artifactId>kubernetes-client</artifactId>
                <version>${kubernetes-client.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>

            <!--test-->
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest</artifactId>
                <version>${hamcrest.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>junit-jupiter</artifactId>
                <version>${testcontainers-junit-jupiter.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>localstack</artifactId>
                <version>${testcontainers-localstack.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>gcloud</artifactId>
                <version>${testcontainers-gcloud.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-loader-tools</artifactId>
                <version>${spring-boot-loader-tools.version}</version>
            </dependency>

        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>@{argLine} -Xms500m -Xmx500m -Xss256k</argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.amashchenko.maven.plugin</groupId>
                <artifactId>gitflow-maven-plugin</artifactId>
                <version>${gitflow-maven-plugin.version}</version>
                <configuration>
                    <allowSnapshots>false</allowSnapshots>
                    <verbose>true</verbose>
                    <commitMessagePrefix>[ci skip]</commitMessagePrefix>
                    <gitFlowConfig>
                        <developmentBranch>master</developmentBranch>
                    </gitFlowConfig>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jreleaser</groupId>
                <artifactId>jreleaser-maven-plugin</artifactId>
                <version>${jreleaser-maven-plugin.version}</version>
                <configuration>
                    <jreleaser>
                        <signing>
                            <active>ALWAYS</active>
                            <armored>true</armored>
                        </signing>
                        <deploy>
                            <maven>
                                <pomchecker>
                                    <strict>false</strict>
                                </pomchecker>
                                <mavenCentral>
                                    <sonatype>
                                        <active>RELEASE</active>
                                        <url>https://central.sonatype.com/api/v1/publisher</url>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </sonatype>
                                </mavenCentral>
                                <nexus2>
                                    <maven-central>
                                        <active>SNAPSHOT</active>
                                        <url>https://ossrh-staging-api.central.sonatype.com/service/local</url>
                                        <snapshotUrl>https://central.sonatype.com/repository/maven-snapshots</snapshotUrl>
                                        <applyMavenCentralRules>true</applyMavenCentralRules>
                                        <snapshotSupported>true</snapshotSupported>
                                        <closeRepository>true</closeRepository>
                                        <releaseRepository>true</releaseRepository>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </maven-central>
                                </nexus2>
                            </maven>
                        </deploy>
                        <release>
                            <github>
                                <skipTag>false</skipTag>
                                <skipRelease>true</skipRelease>
                            </github>
                        </release>
                    </jreleaser>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.hubspot.maven.plugins</groupId>
                <artifactId>prettier-maven-plugin</artifactId>
                <version>${prettier-maven-plugin.version}</version>
                <configuration>
                    <prettierJavaVersion>${prettier-java.version}</prettierJavaVersion>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>${plugin.prettier.goal}</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>publication</id>
            <properties>
                <altDeploymentRepository>local::default::file:./target/staging-deploy</altDeploymentRepository>
            </properties>
            <build>
                <defaultGoal>deploy</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>${sonar-maven-plugin.version}</version>
                    </plugin>
                    <plugin>
                        <groupId>com.hubspot.maven.plugins</groupId>
                        <artifactId>prettier-maven-plugin</artifactId>
                        <version>${prettier-maven-plugin.version}</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>prettierCheck</id>
            <properties>
                <!-- In the CI environment we want to validate that code is formatted -->
                <plugin.prettier.goal>check</plugin.prettier.goal>
            </properties>
        </profile>
    </profiles>

</project>
