<?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>com.github.shyiko.dotenv</groupId>
    <artifactId>pom</artifactId>
    <version>0.1.1</version>
    <packaging>pom</packaging>

    <name>pom</name>
    <description>A twelve-factor configuration library for Java 8+</description>
    <url>https://github.com/shyiko/dotenv</url>
    <licenses>
        <license>
            <name>MIT</name>
            <url>https://opensource.org/licenses/MIT</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:git@github.com:shyiko/dotenv.git</connection>
        <developerConnection>scm:git:git@github.com:shyiko/dotenv.git</developerConnection>
        <url>git@github.com:shyiko/dotenv.git</url>
    </scm>
    <developers>
        <developer>
            <id>shyiko</id>
            <email>stanley.shyiko@gmail.com</email>
            <name>Stanley Shyiko</name>
        </developer>
    </developers>
    <distributionManagement>
        <repository>
            <id>maven-central</id>
            <name>Sonatype Nexus Staging</name>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
        </repository>
    </distributionManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <guice.version>4.0</guice.version>
        <testng.version>6.9.10</testng.version>
        <assertj.version>3.3.0</assertj.version>
    </properties>

    <modules>
        <module>dotenv</module>
        <module>dotenv-guice</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <!-- for class.getPackage().getImplementationVersion() -->
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.shyiko.usage-maven-plugin</groupId>
                <artifactId>usage-maven-plugin</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <usage>
                        # test
                        ./mvnw clean verify

                        # publish a new version
                        ./mvnw versions:set -DnewVersion=&lt;version&gt;
                        ./mvnw -Ddeploy=maven-central
                        ./mvnw -Ddeploy=github-release-notes -N
                    </usage>
                </configuration>
            </plugin>
        </plugins>
        <extensions>
            <extension>
                <groupId>com.github.shyiko.servers-maven-extension</groupId>
                <artifactId>servers-maven-extension</artifactId>
                <version>1.3.0</version>
            </extension>
            <extension>
                <groupId>com.github.shyiko.usage-maven-plugin</groupId>
                <artifactId>usage-maven-plugin</artifactId>
                <version>1.0.0</version>
            </extension>
        </extensions>
    </build>

    <profiles>
        <profile>
            <id>deploy-to-maven-central</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>maven-central</value>
                </property>
            </activation>
            <build>
                <defaultGoal>clean deploy</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.0.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.4</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <additionalparam>-Xdoclint:none</additionalparam>
                                    <quiet>true</quiet>
                                </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>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.7</version>
                        <extensions>true</extensions>
                        <configuration>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <serverId>maven-central</serverId>
                            <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
                            <!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy-to-github</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>github</value>
                </property>
            </activation>
            <build>
                <defaultGoal>clean deploy</defaultGoal>
            </build>
        </profile>
        <profile>
            <!--
                https://github.com/mattbrictson/chandler must be installed and available on PATH
            -->
            <id>update-github-release-notes</id>
            <activation>
                <property>
                    <name>deploy</name>
                    <value>github-release-notes</value>
                </property>
            </activation>
            <build>
                <defaultGoal>antrun:run</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <configuration>
                            <target name="update-github-release-notes">
                                <exec executable="chandler" dir="${basedir}" failonerror="true">
                                    <arg value="push"/>
                                    <arg value="${project.version}"/>
                                    <env key="CHANDLER_GITHUB_API_TOKEN" value="${settings.servers.github.privateKey}"/>
                                </exec>
                            </target>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
