<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ /*
  ~
  ~   *******************************************************************************
  ~
  ~     Copyright (c) 2023-24 Harman International
  ~
  ~
  ~
  ~     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.
  ~
  ~
  ~
  ~     SPDX-License-Identifier: Apache-2.0
  ~
  ~    *******************************************************************************
  ~
  ~  */
  -->
<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>
	<groupId>org.eclipse.ecsp</groupId>
	<artifactId>sql-dao</artifactId>
	<version>1.2.3</version>
	
	<name>SQL DAO Library</name>
	<description>DAO framework for SQL databases</description>
	<url>https://github.com/eclipse-ecsp/sql-dao</url>

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

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

    <developers>
        <developer>
            <id>kaushalaroraharman</id>
            <name>Kaushal Arora</name>
            <email>kaushal.arora@harman.com</email>
        </developer>
        <developer>
            <id>ihussainbadshah</id>
            <name>Hussain Badshah</name>
            <email>hussain.badshah@harman.com</email>
        </developer>
    </developers>

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

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

	<properties>
		<maven.surefire.version>3.5.2</maven.surefire.version>
		<commons.lang3.version>3.13.0</commons.lang3.version>
		<utils.version>1.2.0</utils.version>
		<java.version>25</java.version>
		<maven.compiler.source>${java.version}</maven.compiler.source>
		<maven.compiler.target>${java.version}</maven.compiler.target>
		<hikaricp.version>5.0.1</hikaricp.version>
		<awaitility.version>4.3.0</awaitility.version>
		<prometheus.client.version>0.6.0</prometheus.client.version>
        <testcontainers.version>2.0.3</testcontainers.version>
		<spring.boot.version>4.0.2</spring.boot.version>
		<lombok.version>1.18.42</lombok.version>
		<postgres.version>42.7.3</postgres.version>
		<dropwizard.version>4.2.19</dropwizard.version>
		<spring.version>7.0.3</spring.version>
		<jacoco.ut.execution.data.file>${project.build.directory}/coverage-reports/jacoco-ut.exec</jacoco.ut.execution.data.file>
		<license-tool-plugin.version>1.1.0</license-tool-plugin.version>
        <install-plugin.version>3.1.1</install-plugin.version>
        <maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
        <sonar.host.url>https://sonarcloud.io</sonar.host.url>
		<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
		<sonar.java.source>25</sonar.java.source>
		<sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}/site/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
		<sonar.language>java</sonar.language>
		<checkstyle.version>10.13.0</checkstyle.version>
		<maven.checkstyle.version>3.3.1</maven.checkstyle.version>
		<checkstyle.config.location>${project.basedir}/checkstyle.xml</checkstyle.config.location>
		<checkstyle.suppressions.location>${project.basedir}/checkstyle-suppressions.xml
		</checkstyle.suppressions.location>
		<sonar.java.checkstyle.reportPaths>${project.build.directory}/checkstyle-result.xml
		</sonar.java.checkstyle.reportPaths>
		<sonar.coverage.exclusions>
        src/main/java/org/eclipse/ecsp/sql/dao/constants/CredentialsConstants.java,
        src/main/java/org/eclipse/ecsp/sql/dao/constants/HealthConstants.java,
        src/main/java/org/eclipse/ecsp/sql/dao/constants/MetricsConstants.java,
        src/main/java/org/eclipse/ecsp/sql/dao/constants/PostgresDbConstants.java,
        src/main/java/org/eclipse/ecsp/sql/dao/constants/MultitenantConstants.java,
        src/main/java/org/eclipse/ecsp/sql/exception/SqlDaoException.java,
        src/main/java/org/eclipse/ecsp/sql/exception/TargetDataSourceNotFoundException.java,
        src/main/java/org/eclipse/ecsp/sql/exception/TenantNotFoundException.java
        </sonar.coverage.exclusions>
	</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>

    <repositories>
        <repository>
            <id>org.sonatype.central</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

	<dependencies>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>testcontainers-postgresql</artifactId>
			<version>${testcontainers.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.testcontainers</groupId>
			<artifactId>testcontainers-junit-jupiter</artifactId>
			<version>${testcontainers.version}</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-data-jpa</artifactId>
			<version>${spring.boot.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-logging</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<version>${spring.boot.version}</version>
			<scope>test</scope>
		</dependency>
		
		<dependency>
		    <groupId>org.awaitility</groupId>
		    <artifactId>awaitility</artifactId>
		    <version>${awaitility.version}</version>
		    <scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.eclipse.ecsp</groupId>
			<artifactId>utils</artifactId>
			<version>${utils.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-autoconfigure</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-context</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-core</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework</groupId>
					<artifactId>spring-aop</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.springframework.boot</groupId>
					<artifactId>spring-boot-starter-aspectj</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.mongodb</groupId>
					<artifactId>mongodb-driver-legacy</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.mongodb</groupId>
					<artifactId>mongodb-driver-sync</artifactId>
				</exclusion>
				<exclusion>
					<groupId>dev.morphia.morphia</groupId>
					<artifactId>morphia-core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-aspectj</artifactId>
			<version>${spring.boot.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-autoconfigure</artifactId>
			<version>${spring.boot.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-aop</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${spring.version}</version>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<optional>true</optional>
			<version>${lombok.version}</version>
			<type>jar</type>
		</dependency>

		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>${postgres.version}</version>
		</dependency>

		<dependency>
			<groupId>com.zaxxer</groupId>
			<artifactId>HikariCP</artifactId>
			<version>${hikaricp.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>${commons.lang3.version}</version>
		</dependency>

		<dependency>
			<groupId>io.dropwizard.metrics</groupId>
			<artifactId>metrics-healthchecks</artifactId>
			<version>${dropwizard.version}</version>
			<exclusions>
				<exclusion>
					<groupId>org.slf4j</groupId>
					<artifactId>slf4j-api</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<!-- Prometheus Dependencies -->
		<dependency>
			<groupId>io.prometheus</groupId>
			<artifactId>simpleclient</artifactId>
			<version>${prometheus.client.version}</version>
		</dependency>
		<!-- Hotspot JVM metrics -->
		<dependency>
			<groupId>io.prometheus</groupId>
			<artifactId>simpleclient_hotspot</artifactId>
			<version>${prometheus.client.version}</version>
		</dependency>
		<!-- Exposition HTTPServer -->
		<dependency>
			<groupId>io.prometheus</groupId>
			<artifactId>simpleclient_httpserver</artifactId>
			<version>${prometheus.client.version}</version>
		</dependency>
		<dependency>
			<groupId>io.prometheus</groupId>
			<artifactId>simpleclient_servlet</artifactId>
			<version>${prometheus.client.version}</version>
		</dependency>
		<dependency>
			<groupId>jakarta.annotation</groupId>
			<artifactId>jakarta.annotation-api</artifactId>
			<version>3.0.0</version>
		</dependency>
	</dependencies>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.14.0</version>
				<configuration>
					<release>${java.version}</release>
					<annotationProcessorPaths>
						<path>
							<groupId>org.projectlombok</groupId>
							<artifactId>lombok</artifactId>
							<version>${lombok.version}</version>
						</path>
					</annotationProcessorPaths>
				</configuration>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
				<version>${install-plugin.version}</version>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-gpg-plugin</artifactId>
				<version>${maven-gpg-plugin.version}</version>
				<configuration>
					<gpgArguments>
						<arg>--pinentry-mode</arg>
						<arg>loopback</arg>
						<arg>--batch</arg>
						<arg>--yes</arg>
					</gpgArguments>
				</configuration>
			</plugin>
			
			<plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>**/jar/</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
			
			<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <minimizeJar>false</minimizeJar>
                            <artifactSet/>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
			
			<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
				
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>${maven.surefire.version}</version>
				<configuration>
					<argLine>${surefireArgLine}</argLine>
					<includes>
						<include>**/*Test*.java</include>
						<threadCount>1</threadCount>
					</includes>
				</configuration>
			</plugin>
			
			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>0.8.14</version>
				<configuration>
					<excludes>
						<exclude>org/eclipse/ecsp/sql/dao/constants/CredentialsConstants.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/dao/constants/HealthConstants.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/dao/constants/MetricsConstants.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/dao/constants/PostgresDbConstants.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/dao/exception/SqlDaoException.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/dao/constants/MultitenantConstants.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/exception/TargetDataSourceNotFoundException.class</exclude>
                        <exclude>org/eclipse/ecsp/sql/exception/TenantNotFoundException.class</exclude>
					</excludes>
				</configuration>
				<executions>
					<!-- Prepares the property pointing to the JaCoCo runtime
                    agent which is passed as VM argument when Maven the Surefire plugin is executed. -->
					<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>
							<!-- Sets the name of the property containing
                            the settings for JaCoCo runtime agent. -->
							<propertyName>surefireArgLine</propertyName>
							<excludes>
								<exclude>**/*Constant*</exclude>
							</excludes>
						</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>
			
			<plugin>
				<groupId>org.sonarsource.scanner.maven</groupId>
				<artifactId>sonar-maven-plugin</artifactId>
				<version>3.10.0.2594</version>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-failsafe-plugin</artifactId>
				<version>2.22.0</version>
				<configuration>
					<argLine>
						– illegal-access=permit
					</argLine>
				</configuration>
			</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-dependency-plugin</artifactId>
				<version>2.10</version>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>process-test-resources</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
						</configuration>
					</execution>
				</executions>
			</plugin>
			
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>${maven.checkstyle.version}</version>
				<executions>
					<execution>
						<id>validate</id>
						<phase>validate</phase>
						<configuration>
							<suppressionsLocation>${project.basedir}/checkstyle-suppressions.xml</suppressionsLocation>
							<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>
						</configuration>
						<goals>
							<goal>checkstyle</goal>
						</goals>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>com.puppycrawl.tools</groupId>
						<artifactId>checkstyle</artifactId>
						<version>${checkstyle.version}</version>
					</dependency>
				</dependencies>
			</plugin>
			
			<plugin>
                <groupId>org.eclipse.dash</groupId>
                <artifactId>license-tool-plugin</artifactId>
                <version>${license-tool-plugin.version}</version>
                <configuration>
                    <includeScope>test</includeScope>
                </configuration>
                <executions>
                    <execution>
                        <id>license-check</id>
                        <goals>
                            <goal>license-check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
		</plugins>
	</build>
    <profiles>
        <profile>
            <id>dash</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.eclipse.dash</groupId>
                        <artifactId>license-tool-plugin</artifactId>
                        <configuration>
                            <skip>false</skip>
                            <failWhenReviewNeeded>true</failWhenReviewNeeded>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release</id>
            <properties>
                <maven.test.skip>true</maven.test.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                            <waitUntil>published</waitUntil>
                            <centralSnapshotsUrl>https://central.sonatype.com/repository/maven-snapshots/</centralSnapshotsUrl>
                            <skipPublishing>false</skipPublishing>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>javadoc</id>
            <properties>
                <maven.test.skip>true</maven.test.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.2.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <release>${java.version}</release>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
