<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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.eclipse.ecsp</groupId>
    <artifactId>api-gateway-parent</artifactId>
    <version>1.2.3</version>

    <packaging>pom</packaging>

    <modules>
        <module>api-registry-common</module>
        <module>api-registry</module>
        <module>api-gateway</module>
    </modules>

    <name>api-gateway-parent</name>
    <description>A Spring cloud gateway based API Gateway that serves as a single entry point for microservices</description>
    <url>https://github.com/eclipse-ecsp/api-gateway</url>

    <scm>
        <connection>scm:git:https://github.com/eclipse-ecsp/api-gateway.git</connection>
        <url>https://github.com/eclipse-ecsp/api-gateway</url>
        <tag>HEAD</tag>
    </scm>

    <licenses>
        <license>
            <name>Apache-2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/eclipse-ecsp/api-gateway/issues</url>
    </issueManagement>

    <organization>
        <url>https://github.com/eclipse-ecsp</url>
        <name>eclipse-ecsp</name>
    </organization>

    <developers>
        <developer>
            <id>abhishekkumar-harman</id>
            <name>Abhishek Kumar</name>
            <email>Abhishek.Kumar87@harman.com</email>
        </developer>
    </developers>

    <properties>
        <!-- general properties ordered by name -->
        <java.version>17</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <!--  ignite-properties -->
        <ecsp.utils.version>1.1.1</ecsp.utils.version>
        <!-- dependant versions ordered by artifactId -->
        <hibernate-types-60.version>2.21.1</hibernate-types-60.version>
        <jackson-bom.version>2.19.0</jackson-bom.version>
        <jjwt.version>0.12.6</jjwt.version>
        <lombok.version>1.18.38</lombok.version>
        <spring-boot.version>3.5.3</spring-boot.version>
        <spring-cloud.version>2025.0.0</spring-cloud.version>
        <spring-cloud-resilience4j.version>3.3.0</spring-cloud-resilience4j.version>
        <spring-cloud-starter-gateway.version>4.3.0</spring-cloud-starter-gateway.version>
        <springdoc.version>2.8.9</springdoc.version>
        <!-- maven-plugin dependant versions ordered by artifactId -->
        <jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
        <maven-clean-plugin.version>3.4.1</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.14.0</maven-compiler-plugin.version>
        <maven-dependency-plugin.version>3.8.1</maven-dependency-plugin.version>
        <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
        <maven-failsafe-plugin.version>3.5.3</maven-failsafe-plugin.version>
        <maven-jar-plugin.version>3.4.2</maven-jar-plugin.version>
        <maven-release-plugin.version>3.1.1</maven-release-plugin.version>
        <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
        <maven-war-plugin.version>3.4.0</maven-war-plugin.version>

        <!--Checkstyle plugin properties -->
        <checkstyle.version>10.23.0</checkstyle.version>
        <maven.checkstyle.plugin.version>3.6.0</maven.checkstyle.plugin.version>
        <checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
        <checkstyle.suppressions.location>checkstyle-suppressions.xml</checkstyle.suppressions.location>
        <sonar.java.checkstyle.reportPaths>${project.build.directory}/checkstyle-result.xml
        </sonar.java.checkstyle.reportPaths>

        <!-- Sonar plugin properties -->
        <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
        <sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco-ut/jacoco.xml
        </sonar.coverage.jacoco.xmlReportPaths>
        <sonar.language>java</sonar.language>
        <sonar-maven-plugin.version>5.1.0.4751</sonar-maven-plugin.version>
        <sonar.exclusions>
            <!-- Gateway -->
            **/ApiGatewayApplication.java,
            **/gateway/config/*.java,
            **/gateway/model/*.java,
            **/gateway/plugins/AccessLog.java,
            **/gateway/plugins/PluginLoader.java,
            **/gateway/service/IgniteRouteLocator.java,
            **/gateway/service/RegistryRouteLoader.java,
            **/gateway/service/RouteUtils.java,
            **/gateway/utils/*.java,
            **/gateway/metrics/*.java,

            <!-- Registry -->
            **/RegistryApplication.java,
            **/registry/config/*.java,
            **/registry/repo/*.java,
            **/registry/metrics/*.java,
            **/registry/utils/RegistryConstants.java,

            <!-- Registry Common -->
            **/config/*.java,
            **/restclient/RestTemplateConfig.java,
            **/register/model/*.java,
            **/register/ApiRoutesConfig.java,
            **/security/Scopes.java,
            **/security/ScopeTagger.java,
            **/security/CachingTagger.java,
            **/security/Security.java,
            **/security/UserDetails.java,
            **/security/CustomHeaders.java,
            **/utils/Constants.java
        </sonar.exclusions>
        <jacoco.ut.execution.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec
        </jacoco.ut.execution.data.file>
        <spring-security.version>6.5.1</spring-security.version>
        <tomcat-embed.version>10.1.42</tomcat-embed.version>
        <bouncycastle.version>1.80</bouncycastle.version>
        <nimbus-jose-jwt.version>10.3</nimbus-jose-jwt.version>
        <openapi-schema-validator.version>1.0.7</openapi-schema-validator.version>
        <junit-platform-launcher.version>1.12.1</junit-platform-launcher.version>
        <cyclonedx-maven-plugin.version>2.9.1</cyclonedx-maven-plugin.version>
        <wiremock.version>3.13.0</wiremock.version>
        <maven-source-plugin.version>3.3.1</maven-source-plugin.version>
        <maven-javadoc-plugin.version>3.11.2</maven-javadoc-plugin.version>
        <license-tool-plugin.version>1.1.0</license-tool-plugin.version>
        <skipDash>true</skipDash>
        <failWhenReviewNeeded>false</failWhenReviewNeeded>
        <logback-gelf.version>6.1.1</logback-gelf.version>
        <maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
        <skipCheckstyle>false</skipCheckstyle>
        <skipJavadocs>false</skipJavadocs>
        <skipSource>false</skipSource>
        <skipGpgSign>true</skipGpgSign>
        <skipMavenPublishing>true</skipMavenPublishing>
        <central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
    </properties>

    <pluginRepositories>
        <pluginRepository>
            <id>dash-licenses-releases</id>
            <url>https://repo.eclipse.org/content/repositories/dash-licenses-releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-gateway</artifactId>
                <version>${spring-cloud-starter-gateway.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
                <version>${spring-cloud-resilience4j.version}</version>
            </dependency>
            <dependency>
                <groupId>com.vladmihalcea</groupId>
                <artifactId>hibernate-types-60</artifactId>
                <version>${hibernate-types-60.version}</version>
            </dependency>
            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <version>${lombok.version}</version>
            </dependency>
            <!-- OpenAPI 3 -->
            <dependency>
                <groupId>org.springdoc</groupId>
                <artifactId>springdoc-openapi</artifactId>
                <version>${springdoc.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <!--  other dependencies -->
            <dependency>
                <groupId>com.fasterxml.jackson</groupId>
                <artifactId>jackson-bom</artifactId>
                <version>${jackson-bom.version}</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-impl</artifactId>
                <version>${jjwt.version}</version>
            </dependency>
            <dependency>
                <groupId>io.jsonwebtoken</groupId>
                <artifactId>jjwt-gson</artifactId>
                <version>${jjwt.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <version>${spring-boot.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>de.siegmar</groupId>
                <artifactId>logback-gelf</artifactId>
                <version>${logback-gelf.version}</version>
            </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.cyclonedx</groupId>
                    <artifactId>cyclonedx-maven-plugin</artifactId>
                    <version>${cyclonedx-maven-plugin.version}</version>
                    <configuration>
                        <projectType>application</projectType>
                        <schemaVersion>1.5</schemaVersion>
                        <includeBomSerialNumber>true</includeBomSerialNumber>
                        <includeCompileScope>true</includeCompileScope>
                        <includeProvidedScope>true</includeProvidedScope>
                        <includeRuntimeScope>true</includeRuntimeScope>
                        <includeSystemScope>true</includeSystemScope>
                        <includeTestScope>true</includeTestScope>
                        <includeLicenseText>true</includeLicenseText>
                        <outputFormat>all</outputFormat>
                        <outputDirectory>${project.basedir}/sbom</outputDirectory>
                        <verbose>false</verbose>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>makeAggregateBom</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <compilerArgs>
                            <arg>-parameters</arg>
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven-dependency-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-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>${maven-release-plugin.version}</version>
                    <configuration>
                        <preparationGoals>package docker:push</preparationGoals>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven-war-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${sonar-maven-plugin.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                    <version>${spring-boot.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <forkCount>3</forkCount>
                        <reuseForks>true</reuseForks>
                        <forkMode>pertest</forkMode>
                        <argLine>${surefireArgLine}</argLine>
                        <childDelegation>true</childDelegation>
                        <skipTests>false</skipTests>
                        <runOrder>alphabetical</runOrder>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>pre-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->
                                <destFile>${jacoco.ut.execution.data.file}</destFile>
                                <propertyName>surefireArgLine</propertyName>
                            </configuration>
                        </execution>
                        <!-- Ensures that the code coverage report for unit tests is created
                            after unit tests have been run. -->
                        <execution>
                            <id>post-unit-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->
                                <dataFile>${jacoco.ut.execution.data.file}</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.cyclonedx</groupId>
                <artifactId>cyclonedx-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.sonarsource.scanner.maven</groupId>
                <artifactId>sonar-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven.checkstyle.plugin.version}</version>
                <executions>
                    <execution>
                        <id>validate</id>
                        <phase>validate</phase>
                        <configuration>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <outputFileFormat>xml</outputFileFormat>
                            <failsOnError>true</failsOnError>
                            <failOnViolation>true</failOnViolation>
                            <violationSeverity>warning</violationSeverity>
                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
                            <includeResources>true</includeResources>
                            <includeTestResources>true</includeTestResources>
                            <skip>${skipCheckstyle}</skip>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>${checkstyle.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>${maven-source-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                        <configuration>
                            <classifier>sources</classifier>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <skipSource>${skipSource}</skipSource>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <skip>${skipJavadocs}</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eclipse.dash</groupId>
                <artifactId>license-tool-plugin</artifactId>
                <version>${license-tool-plugin.version}</version>
                <configuration>
                    <includeScope>test</includeScope>
                    <skip>${skipDash}</skip>
                    <failWhenReviewNeeded>${failWhenReviewNeeded}</failWhenReviewNeeded>
                </configuration>
                <executions>
                    <execution>
                        <id>license-check</id>
                        <goals>
                            <goal>license-check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <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>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <gpgArguments>
                        <arg>--pinentry-mode</arg>
                        <arg>loopback</arg>
                        <arg>--batch</arg>
                        <arg>--yes</arg>
                    </gpgArguments>
                    <skip>${skipGpgSign}</skip>
                </configuration>
            </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</publishingServerId>
                    <autoPublish>true</autoPublish>
                    <waitUntil>published</waitUntil>
                    <centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</centralSnapshotsUrl>
                    <skipPublishing>${skipMavenPublishing}</skipPublishing>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <skipDash>true</skipDash>
                <skipTests>false</skipTests>
                <skipGpgSign>true</skipGpgSign>
                <skipJavadocs>false</skipJavadocs>
                <skipSource>false</skipSource>
                <skipMavenPublishing>true</skipMavenPublishing>
            </properties>
        </profile>
        <profile>
            <id>dash</id>
            <properties>
                <skipDash>false</skipDash>
                <failWhenReviewNeeded>true</failWhenReviewNeeded>
                <skipTests>true</skipTests>
                <skipCheckstyle>true</skipCheckstyle>
                <skipGpgSign>true</skipGpgSign>
                <skipJavadocs>true</skipJavadocs>
                <skipSource>true</skipSource>
                <skipMavenPublishing>true</skipMavenPublishing>
            </properties>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <skipDash>true</skipDash>
                <skipTests>false</skipTests>
                <skipGpgSign>false</skipGpgSign>
                <skipJavadocs>false</skipJavadocs>
                <skipSource>false</skipSource>
                <skipMavenPublishing>false</skipMavenPublishing>
            </properties>
        </profile>
    </profiles>
</project>
