<?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>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
        <relativePath />
    </parent>

    <groupId>com.github.database-rider</groupId>
    <artifactId>rider-parent</artifactId>
    <packaging>pom</packaging>
    <!-- tag::version[] -->
    <version>1.32.3</version>
    <!-- end::version[] -->

    <modules>
        <module>rider-core</module>
        <module>rider-cdi</module>
        <module>rider-cucumber</module>
        <module>rider-examples</module>
        <module>rider-junit5</module>
        <module>rider-spring</module>
    </modules>

    <name>database-rider</name>
    <url>https://github.com/database-rider/database-rider</url>

    <description>
        Database testing made easy with JUnit and DBUnit.
    </description>

    <developers>
        <developer>
            <name>Rafael M. Pestano</name>
            <email>rmpestanoATgmail.com</email>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:https://github.com/database-rider/database-rider.git</connection>
        <developerConnection>scm:git:git@github.com:database-rider/database-rider.git</developerConnection>
        <url>https://github.com/database-rider/database-rider.git</url>
        <tag>1.32.3</tag>
    </scm>

    <ciManagement>
        <system>tranvis-ci.org</system>
        <url>https://travis-ci.org/database-rider/database-rider</url>
    </ciManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <jacoco.version>0.8.7</jacoco.version>
        <ds.version>1.9.5</ds.version>
        <surefire.version>3.0.0-M5</surefire.version>
        <testcontainers.version>1.15.3</testcontainers.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.1</version>
            <scope>provided</scope>
        </dependency>
        <!-- test -->
        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>2.6.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>2.9.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.35</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.dbunit</groupId>
                <artifactId>dbunit</artifactId>
                <version>2.7.0</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>1.10.19</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-lgpl</artifactId>
                <version>1.9.13</version>
            </dependency>
            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>1.16</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*It.java</include>
                        <include>**/*Test.java</include>
                        <include>**/*Feature.java</include>
                        <include>**/*Bdd.java</include>
                    </includes>
                    <systemPropertyVariables>
                        <java.util.logging.config.file>
                            src/test/resources/logging.properties
                        </java.util.logging.config.file>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${surefire.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>

        <profile>
            <id>coverage</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>${jacoco.version}</version>
                        <configuration>
                            <!-- basically excludes classes from examples projects-->
                            <excludes>
                                <exclude>**/*Repository.*</exclude>
                                <exclude>**/Q*</exclude>
                                <exclude>**/*Service.*</exclude>
                                <exclude>**/*User.*</exclude>
                                <exclude>**/*UserRepository.*</exclude>
                                <exclude>**/*UserController.*</exclude>
                                <exclude>**/*Application.*</exclude>
                                <exclude>**/*MainController.*</exclude>
                                <exclude>**/*UserRepositoryTest.*</exclude>
                                <exclude>**/*Contact*</exclude>
                                <exclude>**/*Company*</exclude>
                                <exclude>**/*AbstractEntity*</exclude>
                                <exclude>**/*CdiConfig*</exclude>
                                <exclude>**/*CompanyRepository*</exclude>
                                <exclude>**/*Author.*</exclude>
                                <exclude>**/*Book.*</exclude>
                                <exclude>**/*AuthorRecord.*</exclude>
                                <exclude>**/*BookRecord.*</exclude>
                                <exclude>**/*Sequences.*</exclude>
                                <exclude>**/*Keys*.*</exclude>
                                <exclude>**/*Flyway*.*</exclude>
                                <exclude>**/*DefaultCatalog.*</exclude>
                                <exclude>**/*Tables.*</exclude>
                                <exclude>**/org/example/*</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.eluder.coveralls</groupId>
                        <artifactId>coveralls-maven-plugin</artifactId>
                        <version>4.3.0</version>
                        <configuration>
                            <repoToken>${COVERAGE_TOKEN}</repoToken>
                        </configuration>
                        <dependencies>
                            <dependency>
                                <groupId>javax.xml.bind</groupId>
                                <artifactId>jaxb-api</artifactId>
                                <version>2.3.1</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <reuseForks>false</reuseForks>
                            <threadCount>2</threadCount>
                            <includes>
                                <include>**/*It.java</include>
                                <include>**/*Test.java</include>
                                <include>**/*Feature.java</include>
                                <include>**/*Bdd.java</include>
                            </includes>
                            <excludes>
                                <!-- conflict with open ejb/jpa and jacoco
                                Caused by: org.apache.openejb.OpenEJBException: org.apache.openejb.OpenEJBRuntimeException: <openjpa-2.4.1-r422266:1730418 fatal general error> org.apache.openjpa.persistence.PersistenceException: null: <openjpa-2.4.1-r422266:1730418 fatal general error> org.apache.openjpa.persistence.PersistenceException: null
                                Caused by: org.apache.openejb.OpenEJBRuntimeException: <openjpa-2.4.1-r422266:1730418 fatal general error> org.apache.openjpa.persistence.PersistenceException: null
                                -->
                                <exclude>**/*UserRepositoryTest.java</exclude>
                            </excludes>
                            <systemPropertyVariables>
                                <java.util.logging.config.file>
                                    src/test/resources/logging.properties
                                </java.util.logging.config.file>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.jacoco</groupId>
                    <artifactId>org.jacoco.core</artifactId>
                    <version>${jacoco.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>release</id>
            <properties>
                <docs.outputdir>docs/${project.version}</docs.outputdir>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>releases</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</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>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <!-- Prevent gpg from using pinentry programs -->
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </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>sonar</id>
            <properties>
                <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
                <sonar.jacoco.reportPath>${project.build.directory}/jacoco.exec</sonar.jacoco.reportPath>
                <sonar.language>java</sonar.language>
                <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
                <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
            </properties>
            
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonarsource.scanner.maven</groupId>
                        <artifactId>sonar-maven-plugin</artifactId>
                        <version>3.4.0.905</version>
                    </plugin>
                </plugins>
            </build>    
        </profile>   

    </profiles>

    <distributionManagement>
        <snapshotRepository>
            <id>snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

</project>
