<?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>fr.dralagen</groupId>
    <artifactId>pom</artifactId>
    <version>1.1.0</version>
    <packaging>pom</packaging>

    <name>Pom</name>
    <description>Pom parent who contains the base of pom</description>
    <url>https://github.com/dralagen/pom</url>

    <licenses>
        <license>
            <name>GNU Affero General Public License version 3</name>
            <url>http://www.gnu.org/licenses/agpl.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>dralagen</id>
            <name>Dralagen</name>
            <email>dralagen@dralagen.fr</email>
            <url>http://dralagen.fr</url>
            <timezone>Europe/Paris</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:https://github.com/dralagen/pom.git</connection>
        <developerConnection>scm:git:https://github.com/dralagen/pom.git</developerConnection>
        <url>https://github.com/dralagen/pom</url>
    </scm>

    <properties>
        <!-- class contains the main function -->
        <java.mainClass />
        <java.version>1.6</java.version>
        <jar.addClassPath>true</jar.addClassPath>
        <!-- assemble create a jar with dependencies -->
        <assembly.skipAssembly>true</assembly.skipAssembly>

        <!-- versions -->
        <maven.compiler.plugin.version>3.2</maven.compiler.plugin.version>
        <maven.jar.plugin.version>2.5</maven.jar.plugin.version>
        <maven.assembly.version>2.5.3</maven.assembly.version>
        <maven.dependency.plugin.version>2.10</maven.dependency.plugin.version>
        <maven.deploy.plugin.version>2.8.5</maven.deploy.plugin.version>
        <maven.source.plugin.version>2.4</maven.source.plugin.version>
        <maven.javadoc.plugin.version>2.10.1</maven.javadoc.plugin.version>
        <maven.gpg.plugin.version>1.5</maven.gpg.plugin.version>

        <nexus.staging.version>1.6.5</nexus.staging.version>
        <nexus.staging.server>ossrh</nexus.staging.server>
        <nexus.staging.url>https://oss.sonatype.org/</nexus.staging.url>
        <nexus.staging.autoReleaseAfterClose>true</nexus.staging.autoReleaseAfterClose>

        <jgitflow.version>1.0-m4.3</jgitflow.version>
        <jgitflow.branch.master>master</jgitflow.branch.master>
        <jgitflow.branch.develop>develop</jgitflow.branch.develop>
        <jgitflow.version.tag.prefix>v</jgitflow.version.tag.prefix>
        <jgitflow.auto.version.submodules>true</jgitflow.auto.version.submodules>
        <jgitflow.push.release.branch>false</jgitflow.push.release.branch>
        <jgitflow.allow.untracked>true</jgitflow.allow.untracked>

    </properties>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven.compiler.plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>

                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven.jar.plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>${java.mainClass}</mainClass>
                                <addClasspath>${jar.addClassPath}</addClasspath>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven.assembly.version}</version>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>${java.mainClass}</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>single</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>${maven.dependency.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>copy-dependencies</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

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

                <!--
                    mvn jgitflow:release-start
                    mvn jgitflow:release-finish
                -->
                <plugin>
                    <groupId>external.atlassian.jgitflow</groupId>
                    <artifactId>jgitflow-maven-plugin</artifactId>
                    <version>${jgitflow.version}</version>
                    <configuration>
                        <flowInitContext>
                            <masterBranchName>${jgitflow.branch.master}</masterBranchName>
                            <developBranchName>${jgitflow.branch.develop}</developBranchName>
                            <versionTagPrefix>${jgitflow.version.tag.prefix}</versionTagPrefix>
                        </flowInitContext>
                        <autoVersionSubmodules>${jgitflow.auto.version.submodules}</autoVersionSubmodules>
                        <pushReleases>${jgitflow.push.release.branch}</pushReleases>
                        <allowUntracked>${jgitflow.allow.untracked}</allowUntracked>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
         <profile>
            <id>release-profile</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <gpg.executable>gpg2</gpg.executable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus.staging.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>${nexus.staging.server}</serverId>
                            <nexusUrl>${nexus.staging.url}</nexusUrl>
                            <autoReleaseAfterClose>${nexus.staging.autoReleaseAfterClose}</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven.source.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>