<?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>

    <groupId>dk.kosmisk</groupId>
    <artifactId>postgresql-test-datasource</artifactId>
    <version>1.0.2</version>
    <packaging>jar</packaging>

    <name>${project.groupId}:${project.artifactId}</name>
    
    <description>
        An integration test helper designed for dk.kosmisk:postgresql-maven-plugin.
        
        It is able to create a DataSource that connects to a postgresql, given a
        system-property with a port in it and a database name, or a URI in an
        environment variable or from PG* environment variables or to a personal
        PostgreSQL instance, with user/password/database-name which is the same as
        the user name for the user running the tests.
    </description>
    
    <url>https://github.com/kosmisk-dk/postgresql-test-datasource/</url>
    
    <developers>
        <developer>
            <name>Morten Bøgeskov</name>
            <email>source@kosmisk.dk</email>
            <organization>kosmisk-dk</organization>
            <organizationUrl>https://kosmisk.dk/</organizationUrl>
        </developer>
    </developers>
    
    <scm>
        <connection>scm:git:git://github.com/kosmisk-dk/postgresql-test-datasource.git</connection>
        <developerConnection>scm:git:ssh://github.com:kosmisk-dk/postgresql-test-datasource.git</developerConnection>
        <url>https://github.com/kosmisk-dk/postgresql-test-datasource/tree/master</url>
    </scm>

    <licenses>
        <license>
            <name>The Apache License, Version 2.0</name>
            <url>https://github.com/kosmisk-dk/postgresql-test-datasource/tree/master/LICENSE.txt</url>
        </license>
    </licenses>
    

    <properties>
        <gpg.no-sign>false</gpg.no-sign>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgs>
                        <compilerArg>-Xlint:unchecked</compilerArg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.0</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.1.1</version>
                <executions>
                    <execution> 
                        <goals>
                            <goal>jar</goal>
                        </goals> 
                    </execution> 
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.22.2</version>
                <configuration>
                    <redirectTestOutputToFile>false</redirectTestOutputToFile>
                    <systemPropertyVariables>
                        <postgresql.testbase.port>${postgresql.testbase.port}</postgresql.testbase.port>
                    </systemPropertyVariables>
                    <argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            <plugin>
                <groupId>dk.kosmisk</groupId>
                <artifactId>postgresql-maven-plugin</artifactId>
                <version>1.0.4</version>
                <configuration>
                    <!-- <groupId>dk.kosmisk</groupId> -->
                    <!-- <artifactId>postgresql-binary</artifactId> -->
                    <!--<version>10.2</version>-->
                    <!--<version>LATEST</version>-->
                    <!-- <folder>${project.build.directory}/postgresql</folder> -->
                    <!-- <overwrite>true</overwrite> -->
                </configuration>
                <executions>
                    <execution>
                        <id>postgresql-test-database</id>
                        <goals>
                            <goal>setup</goal>
                            <goal>startup</goal>
                            <goal>shutdown</goal>
                        </goals>
                        <configuration>
                            <!-- <portProperty>postgresql.port</portProperty> -->
                            <!-- <port>${postgresql.port}</port> -->
                            <name>testbase</name>
                            <!-- <user>${user.name}</user> -->
                            <!-- <password>${user.name}</password> -->
                            <!-- <databaseFolder>${folder}/db/${name}</databaseFolder> -->
                            <!-- <logfile>${databaseFolder}.log</logfile> -->
                            <!-- <settings>
                                <archive_command>'rm %p'</archive_command>
                                <archive_mode>on</archive_mode>
                            </settings> -->
                            <scripts>
                                <scritp>${basedir}/src/test/resources/testbase.sql</scritp>
                            </scripts>
                        </configuration>
                    </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>
                        <configuration>
                            <skip>${gpg.no-sign}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>2.7.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.8</version>
            <scope>test</scope>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>annotations</artifactId>
            <version>3.0.1</version>
            <type>jar</type>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <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.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.8</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
    </profiles>

</project>
