<?xml version="1.0" encoding="UTF-8"?>
<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>io.mosip.datashare</groupId>
        <artifactId>durian</artifactId>
        <version>1.3.0</version>
    </parent>

    <artifactId>data-share</artifactId>
    <version>1.3.0</version>
    <packaging>pom</packaging>

    <name>data-share</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <maven.compiler.version>3.11.0</maven.compiler.version>
        <maven.surefire.plugin.version>2.22.0</maven.surefire.plugin.version>
        <maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
        <maven.war.plugin.version>3.1.0</maven.war.plugin.version>
        <maven.jacoco.plugin.version>0.8.11</maven.jacoco.plugin.version>
        <maven.sonar.plugin.version>3.7.0.1746</maven.sonar.plugin.version>
        <maven.javadoc.version>3.2.0</maven.javadoc.version>

        <spring-cloud-config.version>2.0.4.RELEASE</spring-cloud-config.version>
        <h2.version>1.4.197</h2.version>
        <kernel.core.version>1.3.0</kernel.core.version>
        <kernel.logger.logback.version>1.3.0</kernel.logger.logback.version>
        <kernel.crypto-jce.version>1.0.6</kernel.crypto-jce.version>
        <powermock.beta.version>2.0.7</powermock.beta.version>
        <mockito-core.version>3.11.2</mockito-core.version>
        <mockito.version>2.28.2</mockito.version>
        <kernel.object.store.version>1.3.0</kernel.object.store.version>
        <sonar.coverage.exclusions>**/constant/**,**/config/**,**/cache/**,**/dto/**,**/model/**,**/exception/**,**/repository/**,**/security/**,**/*Config.java,**/*Application.java,**/*Handler.java,**/*RestUtil.java</sonar.coverage.exclusions>
        <sonar.cpd.exclusions>**/dto/**,**/config/**,**/api/**</sonar.cpd.exclusions>
        <io.micrometer.prometheus.version>1.4.2</io.micrometer.prometheus.version>
        <gson.version>2.8.4</gson.version>

        <spring.security.web.version>6.2.4</spring.security.web.version>
        <maven.deploy.plugin.version>3.1.1</maven.deploy.plugin.version>
        <central.publishing.maven.plugin.version>0.7.0</central.publishing.maven.plugin.version>
    </properties>

    <modules>
        <module>data-share-service</module>
    </modules>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://central.sonatype.com/api/v1/publisher</url>
        </repository>
    </distributionManagement>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.version}</version>
                    <configuration>
                        <source>${maven.compiler.source}</source>
                        <target>${maven.compiler.target}</target>
                        <compilerArgs>
                            <arg>-parameters</arg> <!-- Include the -parameters flag -->
                        </compilerArgs>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven.javadoc.version}</version>
                    <configuration>
                        <aggregate>true</aggregate>
                        <doclint>none</doclint>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <skipTests>${skipTests}</skipTests>
                    <skip>false</skip>
                    <argLine>
                        ${argLine}
                        --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED
                        --add-opens java.base/java.lang=ALL-UNNAMED
                        --add-opens java.base/java.util=ALL-UNNAMED
                        --add-opens java.base/java.net=ALL-UNNAMED
                        --add-opens java.base/java.time.format=ALL-UNNAMED
                    </argLine>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**/constant/**</exclude>
                        <exclude>**/config/**</exclude>
                        <exclude>**/dto/**</exclude>
                        <exclude>**/entity/**</exclude>
                        <exclude>**/repository/**</exclude>
                        <exclude>**/*BootApplication.class</exclude>
                        <exclude>**/httpfilter/**</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Project-Name>${project.name}</Project-Name>
                            <Project-Version>${project.version}</Project-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven.war.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                        <manifestEntries>
                            <Project-Name>${project.name}</Project-Name>
                            <Project-Version>${project.version}</Project-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.version}</version>
                <configuration>
                    <aggregate>true</aggregate>
                    <doclint>none</doclint>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${maven.deploy.plugin.version}</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>none</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </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>ossrh</publishingServerId>
                    <autoPublish>false</autoPublish>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>sonar</id>
            <properties>
                <sonar.sources>.</sonar.sources>
                <sonar.inclusions>src/main/java/**,src/main/resources/**</sonar.inclusions>
                <sonar.exclusions>${sonar.coverage.exclusions}</sonar.exclusions>
                <sonar.host.url>https://sonarcloud.io</sonar.host.url>
            </properties>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>${maven.sonar.plugin.version}</version>
                        <executions>
                            <execution>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sonar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
