<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>com.github.adrianboimvaser</groupId>
    <artifactId>postgresql-maven-plugin</artifactId>
    <version>0.3-338f4c</version>
    <packaging>maven-plugin</packaging>

    <name>PostgreSQL Maven Plugin</name>

    <url>https://github.com/adrianboimvaser/postgresql-maven-plugin</url>

    <description>This is Maven plugin for doing things with a PostgreSQL database, like starting, stopping, initializing a DB, etc. The main purpose is running integration tests.</description>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>adrianboimvaser</id>
            <name>Adrián Boimvaser</name>
            <email>adrianboimvaser@gmail.com</email>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/adrianboimvaser/postgresql-maven-plugin.git</url>
        <connection>scm:git:git://github.com/adrianboimvaser/postgresql-maven-plugin.git</connection>
        <developerConnection>scm:git:https://github.com/adrianboimvaser/postgresql-maven-plugin.git</developerConnection>
        <tag>HEAD</tag>
    </scm>

    <distributionManagement>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <postgresql-dist.version>9.2.4</postgresql-dist.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>3.0.15</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>1.2</version>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <goalPrefix>postgresql-maven-plugin</goalPrefix>
                    <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
                </configuration>
                <executions>
                    <execution>
                        <id>mojo-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>1.7</version>
                <configuration>
                    <skipInvocation>${skipITs}</skipInvocation>
                    <debug>true</debug>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <pomIncludes>
                        <pomInclude>*/pom.xml</pomInclude>
                    </pomIncludes>
                    <postBuildHookScript>verify</postBuildHookScript>
                    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                    <settingsFile>src/it/settings.xml</settingsFile>
                    <goals>
                        <goal>clean</goal>
                        <goal>install</goal>
                    </goals>
                    <properties>
                        <postgresql-dist.classifier>${postgresql-dist.classifier}</postgresql-dist.classifier>
                        <postgresql-dist.type>${postgresql-dist.type}</postgresql-dist.type>
                    </properties>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>install</goal>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-dependency-plugin</artifactId>
                                        <versionRange>[2.6,)</versionRange>
                                        <goals>
                                            <goal>unpack</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </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>
        </profile>
        <profile>
            <id>unix</id>
            <activation>
                <os>
                    <family>unix</family>
                    <!-- tested on Linux and OSX -->
                </os>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>copy-postgresql-linux</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <skip>${skipITs}</skip>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>com.github.adrianboimvaser</groupId>
                                            <artifactId>postgresql-dist</artifactId>
                                            <classifier>${postgresql-dist.classifier}</classifier>
                                            <version>${postgresql-dist.version}</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.2.1</version>
                        <executions>
                            <execution>
                                <id>unzip-postgresql-linux</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <skip>${skipITs}</skip>
                                    <executable>tar</executable>
                                    <arguments>
                                        <argument>-zxvf</argument>
                                        <argument>${project.build.directory}/postgresql-dist-${postgresql-dist.version}-${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>
                        <version>2.6</version>
                        <executions>
                            <execution>
                                <id>unpack-postgresql-windows</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <skip>${skipITs}</skip>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>com.github.adrianboimvaser</groupId>
                                            <artifactId>postgresql-dist</artifactId>
                                            <classifier>${postgresql-dist.classifier}</classifier>
                                            <version>${postgresql-dist.version}</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>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <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>
                 </plugins>
            </build>
        </profile>
    </profiles>
</project>
