<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.dkirrane.maven.plugins</groupId>
    <artifactId>ggitflow-maven</artifactId>
    <version>1.9</version>
    <name>ggitflow-maven</name>
    <packaging>pom</packaging>

    <modules>
        <module>ggitflow-maven-plugin</module>
        <module>ggitflow-maven-archetype</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <netbeans.hint.license>apache20</netbeans.hint.license>
    </properties>

    <url>https://github.com/dkirrane/ggitflow-maven-plugin</url>

    <scm>
        <url>https://github.com/dkirrane/ggitflow-maven-plugin</url>
        <connection>scm:git:https://github.com/dkirrane/ggitflow-maven-plugin.git</connection>
        <developerConnection>scm:git:https://github.com/dkirrane/ggitflow-maven-plugin.git</developerConnection>
    </scm>

    <description>Maven Archetype for the Gitflow Maven Plugin</description>
    <developers>
        <developer>
            <id>dkirrane</id>
            <name>Desmond Kirrane</name>
            <email>desmond.kirrane@gmail.com</email>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>Apache License Version 2.0, January 2004</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- For Release versions the Sonatype Nexus Stage rules require artifacts to be signed -->
        <!-- http://blog.sonatype.com/2010/01/how-to-generate-pgp-signatures-with-maven -->
        <!-- 1. Setup gpg, @see https://github.com/dkirrane/ggitflow/blob/develop/gradle.properties.sample -->
        <!-- 2. Run Maven deploy sign from Git terminal: mvn clean deploy -Prelease-sign-artifacts -->
        <!-- 3. Login to Nexus to release from the Stage: https://oss.sonatype.org | Login | Staging Repositories | Search for: com.dkirrane | Release -->
        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <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>
                                    <useAgent>false</useAgent>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>run-its</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>1.8</version>
                        <configuration>
                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <debug>true</debug>
                            <showErrors>true</showErrors>
                            <detail>true</detail>
                            <streamLogs>true</streamLogs>
                            <projectsDirectory>src/it/projects</projectsDirectory>
                            <cloneProjectsTo>${java.io.tmpdir}/it/projects</cloneProjectsTo>
                            <!--<cloneProjectsTo>${project.build.directory}/it/projects</cloneProjectsTo>-->
                            <addTestClassPath>true</addTestClassPath>
                            <preBuildHookScript>setup</preBuildHookScript>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <pomIncludes>
                                <pomInclude>*/pom.xml</pomInclude>
                            </pomIncludes>
                            <goals>
                                <goal>clean</goal>
                                <goal>test-compile</goal>
                            </goals>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

            </build>
        </profile>
    </profiles>

    <!--
        Sonatype upload details:
        http://central.sonatype.org/pages/ossrh-guide.html
        http://jedicoder.blogspot.de/2011/11/automated-gradle-project-deployment-to.html
        https://support.sonatype.com/entries/21580432-how-do-i-configure-my-gradle-build-to-publish-artifacts-to-nexus
        https://support.sonatype.com/entries/21597257-how-do-i-stage-artifacts-to-a-nexus-staging-profile-from-a-gradle-build
        https://support.sonatype.com/entries/21596297-how-do-i-configure-my-gradle-build-to-download-artifacts-from-nexus

            - Deploy snapshot artifacts into repository https://oss.sonatype.org/content/repositories/snapshots
            - Deploy release artifacts into the staging repository https://oss.sonatype.org/service/local/staging/deploy/maven2
            - Promote staged artifacts into repository 'Releases'
            - Download snapshot and release artifacts from group https://oss.sonatype.org/content/groups/public
            - Download snapshot, release and staged artifacts from staging group https://oss.sonatype.org/content/groups/staging
    -->

    <distributionManagement>
        <snapshotRepository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </snapshotRepository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
    <repositories>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>
