<?xml version="1.0"?>
<!--
Copyright (c) 2012-2018, jcabi.com
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met: 1) Redistributions of source code must retain the above
copyright notice, this list of conditions and the following
disclaimer. 2) Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution. 3) Neither the name of the jcabi.com nor
the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written
permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>com.jcabi</groupId>
    <artifactId>jcabi</artifactId>
    <version>1.24</version>
  </parent>
  <artifactId>jcabi-jdbc</artifactId>
  <version>0.17.2</version>
  <packaging>jar</packaging>
  <name>jcabi-jdbc</name>
  <description>Fluent Interface to JDBC</description>
  <issueManagement>
    <system>github</system>
    <url>https://github.com/jcabi/jcabi-jdbc/issues</url>
  </issueManagement>
  <ciManagement>
    <system>Travis</system>
    <url>https://travis-ci.org/jcabi/jcabi-jdbc</url>
  </ciManagement>
  <scm>
    <connection>scm:git:github.com:jcabi/jcabi-jdbc.git</connection>
    <developerConnection>scm:git:github.com:jcabi/jcabi-jdbc.git</developerConnection>
    <url>https://github.com/jcabi/jcabi-jdbc</url>
  </scm>
  <distributionManagement>
    <site>
      <id>jdbc.jcabi.com</id>
      <url>http://jdbc.jcabi.com/</url>
    </site>
  </distributionManagement>
  <properties>
    <failsafe.pgsql.user>test</failsafe.pgsql.user>
    <failsafe.pgsql.password>test</failsafe.pgsql.password>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.jcabi</groupId>
      <artifactId>jcabi-aspects</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.4.190</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.1-901-1.jdbc4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.jolbox</groupId>
      <artifactId>bonecp</artifactId>
      <version>0.8.0.RELEASE</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <source>1.8</source>
            <target>1.8</target>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.10</version>
        <executions>
          <execution>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <configuration>
              <portNames>
                <portName>failsafe.pgsql.port</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <failsafe.pgsql.jdbc>jdbc:postgresql://localhost:${failsafe.pgsql.port}/test</failsafe.pgsql.jdbc>
            <failsafe.pgsql.user>${failsafe.pgsql.user}</failsafe.pgsql.user>
            <failsafe.pgsql.password>${failsafe.pgsql.password}</failsafe.pgsql.password>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.adrianboimvaser</groupId>
        <artifactId>postgresql-maven-plugin</artifactId>
        <version>0.2</version>
        <configuration>
          <pgsqlHome>${project.build.directory}/pgsql</pgsqlHome>
          <dataDir>${project.build.directory}/data</dataDir>
          <databaseName>test</databaseName>
          <username>${failsafe.pgsql.user}</username>
          <passwordFile>${project.build.directory}/test-classes/password.txt</passwordFile>
          <port>${failsafe.pgsql.port}</port>
          <timeoutInSeconds>10</timeoutInSeconds>
          <logfile>${project.build.directory}/pgsql/log.file</logfile>
        </configuration>
        <executions>
          <execution>
            <id>init-db</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>initdb</goal>
              <goal>start</goal>
              <goal>createdb</goal>
            </goals>
          </execution>
          <execution>
            <id>stop-postgresql</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>linux-x86</id>
      <activation>
        <os>
          <family>unix</family>
          <name>Linux</name>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <postgresql-dist.classifier>linux</postgresql-dist.classifier>
        <postgresql-dist.type>tar.gz</postgresql-dist.type>
      </properties>
    </profile>
    <profile>
      <id>linux-x64</id>
      <activation>
        <os>
          <family>unix</family>
          <name>Linux</name>
          <arch>amd64</arch>
        </os>
      </activation>
      <properties>
        <postgresql-dist.classifier>linux-x64</postgresql-dist.classifier>
        <postgresql-dist.type>tar.gz</postgresql-dist.type>
      </properties>
    </profile>
    <profile>
      <id>windows-x86</id>
      <activation>
        <os>
          <family>windows</family>
          <arch>x86</arch>
        </os>
      </activation>
      <properties>
        <postgresql-dist.classifier>windows</postgresql-dist.classifier>
        <postgresql-dist.type>zip</postgresql-dist.type>
      </properties>
    </profile>
    <profile>
      <id>windows-x64</id>
      <activation>
        <os>
          <family>windows</family>
          <arch>amd64</arch>
        </os>
      </activation>
      <properties>
        <postgresql-dist.classifier>windows-x64</postgresql-dist.classifier>
        <postgresql-dist.type>zip</postgresql-dist.type>
      </properties>
    </profile>
    <profile>
      <id>osx</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <postgresql-dist.classifier>osx</postgresql-dist.classifier>
        <postgresql-dist.type>zip</postgresql-dist.type>
      </properties>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-postgresql-osx</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.github.adrianboimvaser</groupId>
                      <artifactId>postgresql-dist</artifactId>
                      <classifier>${postgresql-dist.classifier}</classifier>
                      <version>9.2.4</version>
                      <type>${postgresql-dist.type}</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>linux</id>
      <activation>
        <os>
          <family>unix</family>
          <name>Linux</name>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-postgresql-linux</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.github.adrianboimvaser</groupId>
                      <artifactId>postgresql-dist</artifactId>
                      <classifier>${postgresql-dist.classifier}</classifier>
                      <version>9.2.4</version>
                      <type>${postgresql-dist.type}</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.4.0</version>
            <executions>
              <execution>
                <id>unzip-postgresql-linux</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>tar</executable>
                  <arguments>
                    <argument>-xzf</argument>
                    <argument>${project.build.directory}/postgresql-dist-9.2.4-${postgresql-dist.classifier}.${postgresql-dist.type}</argument>
                    <argument>-C</argument>
                    <argument>${project.build.directory}</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-postgresql-windows</id>
                <phase>prepare-package</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.github.adrianboimvaser</groupId>
                      <artifactId>postgresql-dist</artifactId>
                      <classifier>${postgresql-dist.classifier}</classifier>
                      <version>9.2.4</version>
                      <type>${postgresql-dist.type}</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>qulice</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.qulice</groupId>
            <artifactId>qulice-maven-plugin</artifactId>
            <configuration>
              <excludes combine.children="append">
                <exclude>findbugs:.*</exclude>
                <exclude>snapshots:.*</exclude>
                <exclude>dependencies:.*</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
