<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ ============LICENSE_START=======================================================
  ~ ONAP : ccsdk oran
  ~ ================================================================================
  ~ Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
  ~ Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
  ~ ================================================================================
  ~ 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.
  ~ ============LICENSE_END=======================================================
  ~
-->
<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.onap.ccsdk.parent</groupId>
        <artifactId>spring-boot-31-starter-parent</artifactId>
        <version>2.6.1</version>
        <relativePath/>
    </parent>
    <groupId>org.onap.ccsdk.oran</groupId>
    <artifactId>a1-policy-management-service</artifactId>
    <version>1.8.0-SNAPSHOT</version>
    <name>ccsdk-oran :: ${project.artifactId}</name>
    <properties>
        <java.version.source>17</java.version.source>
        <java.version.target>17</java.version.target>
        <gson.version>2.10.1</gson.version>
        <json.version>20231013</json.version>
        <formatter-maven-plugin.version>2.22.0</formatter-maven-plugin.version>
        <spotless-maven-plugin.version>2.35.0</spotless-maven-plugin.version>
        <commons-io.version>2.14.0</commons-io.version>
        <guava.version>32.0.1-jre</guava.version>
        <springdoc.version>2.0.2</springdoc.version>
        <docker-maven-plugin>0.30.0</docker-maven-plugin>
        <surefire-maven-plugin.version>3.0.0-M8</surefire-maven-plugin.version>
        <surefire-report-plugin.version>3.0.0-M8</surefire-report-plugin.version>
        <jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
        <ccsdk.project.version>${project.version}</ccsdk.project.version>
        <software.amazon.awssdk.version>2.20.12</software.amazon.awssdk.version>
        <allowskiptests>false</allowskiptests>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>io.swagger.core.v3</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>2.2.15</version>
        </dependency>
        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>0.2.4</version>
        </dependency>
        <dependency>
            <!-- Temporary until version 2 is included by the parent spring-boot-starter-parent  -->
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-r2dbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>r2dbc-postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <!-- May be possible to remove this later when ccsdk parent bom stabilizes -->
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>${gson.version}</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>${json.version}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>1.5.5.Final</version>
        </dependency>
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct-processor</artifactId>
            <version>1.5.5.Final</version>
        </dependency>
        <!-- Actuator dependencies -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>software.amazon.awssdk</groupId>
            <artifactId>s3</artifactId>
            <version>${software.amazon.awssdk.version}</version>
        </dependency>
        <!-- For development help -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.awaitility</groupId>
            <artifactId>awaitility</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.erosb</groupId>
            <artifactId>everit-json-schema</artifactId>
            <version>1.14.0</version>
        </dependency>
        <!-- For Tracing -->
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-tracing-bridge-otel</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry</groupId>
            <artifactId>opentelemetry-sdk-extension-jaeger-remote-sampler</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry.instrumentation</groupId>
            <artifactId>opentelemetry-spring-webflux-5.3</artifactId>
        </dependency>
        <dependency>
            <groupId>io.opentelemetry.instrumentation</groupId>
            <artifactId>opentelemetry-spring-boot-starter</artifactId>
        </dependency>
        <!-- For ObservationRegistryCustomizer -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-actuator-autoconfigure</artifactId>
            <version>3.1.0</version>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.opentelemetry</groupId>
                <artifactId>opentelemetry-bom</artifactId>
                <version>1.38.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>io.opentelemetry.instrumentation</groupId>
                <artifactId>opentelemetry-instrumentation-bom-alpha</artifactId>
                <version>2.4.0-alpha</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <version>2.1.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>${basedir}/TagVersion.groovy</source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <version>${formatter-maven-plugin.version}</version>
                <configuration>
                    <lineEnding>LF</lineEnding>
                    <configFile>${project.basedir}/eclipse-formatter.xml</configFile>
                </configuration>
                <!-- https://code.revelc.net/formatter-maven-plugin/ use mvn formatter:format
					spotless:apply process-sources -->
            </plugin>
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${spotless-maven-plugin.version}</version>
                <configuration>
                    <lineEndings>UNIX</lineEndings>
                    <java>
                        <removeUnusedImports/>
                        <importOrder>
                            <order>com,io,java,lombok,javax,org,reactor</order>
                        </importOrder>
                    </java>
                </configuration>
                <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven use
					mvn spotless:apply to rewrite source files use mvn spotless:check to validate
					source files -->
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${surefire-maven-plugin.version}</version>
                <configuration>
                    <skipTests>${allowskiptests}</skipTests>
                    <statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
                        <usePhrasedFileName>false</usePhrasedFileName>
                        <usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
                        <usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
                        <usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
                    </statelessTestsetReporter>
                    <consoleOutputReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5ConsoleOutputReporter">
                        <usePhrasedFileName>false</usePhrasedFileName>
                    </consoleOutputReporter>
                    <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5StatelessTestsetInfoReporter">
                        <usePhrasedFileName>false</usePhrasedFileName>
                        <usePhrasedClassNameInRunning>true</usePhrasedClassNameInRunning>
                        <usePhrasedClassNameInTestCaseSummary>true</usePhrasedClassNameInTestCaseSummary>
                    </statelessTestsetInfoReporter>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/annotations/</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </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>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.swagger.codegen.v3</groupId>
                <artifactId>swagger-codegen-maven-plugin</artifactId>
                <version>3.0.46</version>
                <executions>
                    <execution>
                        <id>generate-openapi-json</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/api/pms-api.yaml</inputSpec>
                            <language>openapi</language>
                            <output>${project.basedir}/api</output>
                            <configOptions>
                                <outputFile>pms-api.json</outputFile>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>6.6.0</version>
                <executions>
                    <execution>
                        <id>generate-openapi-html</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/api/pms-api.json</inputSpec>
                            <generatorName>html2</generatorName>
                            <output>${project.basedir}/api/pms-api</output>
                            <skipOperationExample>false</skipOperationExample>
                            <strictSpec>false</strictSpec>
                            <configOptions>
                                <appDescription>The O-RAN Non-RT RIC Policy Management Service
                                    provides a REST API for managing O-RAN A1 Policies.</appDescription>
                                <appName>ONAP CCSDK A1 Policy Management Service</appName>
                                <infoUrl>https://wiki.onap.org/display/DW/O-RAN+A1+Policies+in+ONAP</infoUrl>
                                <licenseInfo>Copyright (C) 2020-2023 Nordix Foundation. Licensed
                                    under the Apache License, and Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.</licenseInfo>
                                <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
                            </configOptions>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-policy-api</id>
                        <phase>generate-sources	</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/api/pms-api.yaml</inputSpec>
                            <invokerPackage>${project.groupId}.a1policymanagementservice.controllers.v2</invokerPackage>
                            <apiPackage>${project.groupId}.a1policymanagementservice.controllers.api.v2</apiPackage>
                            <modelPackage>${project.groupId}.a1policymanagementservice.models.v2</modelPackage>
                            <generateApiTests>false</generateApiTests>
                            <generateModelTests>false</generateModelTests>
                            <generatorName>spring</generatorName>
                            <generateSupportingFiles>false</generateSupportingFiles>
                            <skipValidateSpec>false</skipValidateSpec>
                            <library>spring-boot</library>
                            <configOptions>
                                <sourceFolder>src/gen/java</sourceFolder>
                                <interfaceOnly>true</interfaceOnly>
                                <useTags>true</useTags>
                                <reactive>true</reactive>
                                <dateLibrary>java8</dateLibrary>
                                <java8>true</java8>
                                <unhandledException>true</unhandledException>
                                <openApiNullable>false</openApiNullable>
                                <skipDefaultInterface>true</skipDefaultInterface>
                            </configOptions>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-policy-api-v3</id>
                        <phase>generate-sources	</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.basedir}/api/pms-api-v3.yaml</inputSpec>
                            <invokerPackage>${project.groupId}.a1policymanagementservice.controllers.v3</invokerPackage>
                            <apiPackage>${project.groupId}.a1policymanagementservice.controllers.api.v3</apiPackage>
                            <modelPackage>${project.groupId}.a1policymanagementservice.models.v3</modelPackage>
                            <generateApiTests>false</generateApiTests>
                            <generateModelTests>false</generateModelTests>
                            <generatorName>spring</generatorName>
                            <generateSupportingFiles>false</generateSupportingFiles>
                            <skipValidateSpec>false</skipValidateSpec>
                            <library>spring-boot</library>
                            <configOptions>
                                <sourceFolder>src/gen/java</sourceFolder>
                                <interfaceOnly>true</interfaceOnly>
                                <useTags>true</useTags>
                                <reactive>true</reactive>
                                <dateLibrary>java8</dateLibrary>
                                <java8>true</java8>
                                <unhandledException>true</unhandledException>
                                <openApiNullable>false</openApiNullable>
                                <skipDefaultInterface>true</skipDefaultInterface>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resource-openapi</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.basedir}/../docs/offeredapis/swagger</outputDirectory>
                            <overwrite>true</overwrite>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/api</directory>
                                    <includes>
                                        <include>pms-api.json</include>
                                        <include>pms-api.yaml</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resource-openapi-html</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <verbose>true</verbose>
                            <outputDirectory>
                                ${project.basedir}/../docs/offeredapis/openapitoolgen/offeredapis/pms-api</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/api/pms-api</directory>
                                    <includes>
                                        <include>index.html</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker-maven-plugin}</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>generate-policy-management-service-image</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <images>
                                <image>
                                    <name>
                                        onap/ccsdk-oran-a1policymanagementservice:${project.version}</name>
                                    <build>
                                        <cleanup>try</cleanup>
                                        <contextDir>${basedir}</contextDir>
                                        <dockerFile>Dockerfile</dockerFile>
                                        <args>
                                            <JAR>${project.build.finalName}.jar</JAR>
                                        </args>
                                        <tags>
                                            <tag>${project.version}</tag>
                                        </tags>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                    <execution>
                        <id>push-policy-management-service-image</id>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                        <configuration>
                            <images>
                                <image>
                                    <name>
                                        onap/ccsdk-oran-a1policymanagementservice:${project.version}</name>
                                    <build>
                                        <contextDir>${basedir}</contextDir>
                                        <dockerFile>Dockerfile</dockerFile>
                                        <args>
                                            <JAR>${project.build.finalName}.jar</JAR>
                                        </args>
                                        <tags>
                                            <tag>${project.docker.latestminortag.version}</tag>
                                            <tag>${project.docker.latestfulltag.version}</tag>
                                            <tag>${project.docker.latesttagtimestamp.version}</tag>
                                        </tags>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>${surefire-report-plugin.version}</version>
            </plugin>
        </plugins>
    </reporting>
</project>