<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>4.0.4</version>
    </parent>

    <groupId>org.entur.ror</groupId>
    <artifactId>superpom</artifactId>
    <version>6.1.0</version>
    <packaging>pom</packaging>

    <name>superpom</name>
    <description>Super pom for routes and journey planning components</description>
    <url>https://github.com/entur/superpom</url>
    <organization>
        <name>Entur</name>
        <url>https://www.entur.org/</url>
    </organization>
    <scm>
        <connection>scm:git:ssh://git@github.com/entur/superpom.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/entur/superpom.git</developerConnection>
      <tag>HEAD</tag>
    </scm>
    <distributionManagement>
        <repository>
            <id>central</id>
            <name>entur2-releases</name>
            <url>https://entur2.jfrog.io/entur2/libs-release-local</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>entur2-snapshots</name>
            <url>https://entur2.jfrog.io/entur2/libs-snapshot-local</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>

        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
        <sonar-maven-plugin.version>5.1.0.4751</sonar-maven-plugin.version>

        <google-pubsub-emulator.version>0.1.2</google-pubsub-emulator.version>

        <nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
        <maven-scm-api.version>1.12.2</maven-scm-api.version>
        <maven-scm-provider-gitexe.version>1.12.2</maven-scm-provider-gitexe.version>
        <owasp-dependency-check-plugin.version>12.1.3</owasp-dependency-check-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <gitflow-maven-plugin.version>1.21.0</gitflow-maven-plugin.version>
        <jreleaser-maven-plugin.version>1.19.0</jreleaser-maven-plugin.version>
        <logstash.version>8.1</logstash.version>
        <google.cloud.bom-version>26.66.0</google.cloud.bom-version>

        <!-- Downloading PubSub emulator is disabled by default-->
        <entur.google.pubsub.emulator.download.skip>true</entur.google.pubsub.emulator.download.skip>


    </properties>

    <dependencyManagement>
        <dependencies>

            <dependency>
                <groupId>net.logstash.logback</groupId>
                <artifactId>logstash-logback-encoder</artifactId>
                <version>${logstash.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.cloud</groupId>
                <artifactId>libraries-bom</artifactId>
                <version>${google.cloud.bom-version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>

        </dependencies>

    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <env>dev</env>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <configuration>
                        <doclint>none</doclint>
                        <minmemory>128m</minmemory>
                        <maxmemory>768m</maxmemory>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <fork>true</fork>
                        <release>${java.version}</release>
                        <compilerArgs>
                            <arg>-J-Xss4m</arg>
                            <arg>-Xlint:all</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <configuration>
                        <checkModificationExcludes>
                            <checkModificationExclude>pom.xml</checkModificationExclude>
                        </checkModificationExcludes>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.scm</groupId>
                            <artifactId>maven-scm-api</artifactId>
                            <version>${maven-scm-api.version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.maven.scm</groupId>
                            <artifactId>maven-scm-provider-gitexe</artifactId>
                            <version>${maven-scm-provider-gitexe.version}</version>
                        </dependency>
                    </dependencies>
                </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>
                                    <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>org.owasp</groupId>
                    <artifactId>dependency-check-maven</artifactId>
                    <version>${owasp-dependency-check-plugin.version}</version>
                    <configuration>
                        <nvdApiKey>${NVD_API_KEY}</nvdApiKey>
                        <failBuildOnCVSS>7</failBuildOnCVSS>
                        <failOnError>false</failOnError>
                        <assemblyAnalyzerEnabled>false</assemblyAnalyzerEnabled>
                        <ossindexAnalyzerEnabled>false</ossindexAnalyzerEnabled>
                        <suppressionFiles>
                            <suppressionFile>dependencycheck-suppression.xml</suppressionFile>
                        </suppressionFiles>
                    </configuration>
                 </plugin>

            </plugins>
        </pluginManagement>

        <plugins>
            <!-- enforcer plugin ensures that projects are built with correct java version and correct maven version
                 For more rules, see: http://maven.apache.org/enforcer/enforcer-rules/index.html -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>${java.version}</version>
                                </requireJavaVersion>
                                <requirePluginVersions>
                                    <level>WARN</level>
                                </requirePluginVersions>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-check</id>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <rules />
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
                <version>${sonar-maven-plugin.version}</version>
            </plugin>

            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals><goal>jar</goal></goals>
                    </execution>
                </executions>
            </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>

        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- Trying to create doc java-11 only -->
                    <javadocVersion>${java.version}</javadocVersion>
                    <minmemory>128m</minmemory>
                    <maxmemory>768m</maxmemory>
                    <breakiterator>true</breakiterator>
                    <doclet>org.jboss.apiviz.APIviz</doclet>
                    <docletArtifact>
                        <groupId>org.jboss.apiviz</groupId>
                        <artifactId>apiviz</artifactId>
                        <version>1.3.2.GA</version>
                    </docletArtifact>
                    <useStandardDocletOptions>true</useStandardDocletOptions>
                    <breakiterator>true</breakiterator>
                    <version>true</version>
                    <author>true</author>
                    <keywords>true</keywords>
                </configuration>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>aggregate-no-fork</report>
                            <report>test-aggregate-no-fork</report>
                        </reports>
                    </reportSet>
                </reportSets>

            </plugin>
            <plugin>
                <groupId>org.jreleaser</groupId>
                <artifactId>jreleaser-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>

    <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>
    </profiles>

</project>
