<?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>de.dynamicfiles.projects.minecraft</groupId>
    <artifactId>nbt4j</artifactId>
    <version>1.2</version>

    <packaging>jar</packaging>

    <name>Named Binary Tag 4 Java</name>
    <description>
        Named Binary Tag 4 Java (nbt4j) is intended for reading binary file format used within minecraft-files, e.g. world-data and
        stored player-data being stored in Anvil-format 19133.
    </description>

    <url>https://www.dynamicfiles.de/Projekte/Minecraft-Named-Binary-Tag-NBT</url>

    <inceptionYear>2014</inceptionYear>
    
    <licenses>
        <license>
            <name>CC BY-NC-SA 4.0</name>
            <url>http://creativecommons.org/licenses/by-nc-sa/4.0/deed.de</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Danny Althoff</name>
            <email>fibrefox@dynamicfiles.de</email>
            <url>https://www.dynamicfiles.de/</url>
            <timezone>Europe/Berlin</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git@github.com:fibrefox/nbt4j.git</connection>
        <developerConnection>scm:git:git@github.com:fibrefox/nbt4j.git</developerConnection>
        <url>https://github.com/FibreFoX/nbt4j.git</url>
    </scm>

    <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>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <!-- Code Coverage with SONAR -->
        <sonar.surefire.reportsPath>surefire-reports/junitreports</sonar.surefire.reportsPath>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.java.source>1.8</sonar.java.source>
        <sonar.jacoco.reportPath>${project.build.directory}/jacoco.exec</sonar.jacoco.reportPath>
        <!-- /Code Coverage with SONAR -->

        <!-- testing-dependency versions -->
        <version.testng>6.9.4</version.testng>

        <!-- plugin versions -->
        <version.jacoco.maven>0.7.5.201505241946</version.jacoco.maven>
        <version.maven-surefire-plugin>2.18.1</version.maven-surefire-plugin>

        <version.java.source>1.8</version.java.source>
        <version.java.target>1.8</version.java.target>

        <!-- profile-triggers -->
        <withSrc>false</withSrc>
        <withDoc>false</withDoc>
        <doSign>false</doSign>
        <doRelease>false</doRelease>
    </properties>

    <dependencies>
        <!-- testing -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>${version.testng}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>${project.artifactId}</finalName>
        
        <plugins>
            <!-- Code-coverage with jacoco -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${version.jacoco.maven}</version>
                <executions>
                    <execution>
                        <id>jacoco-initialize</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-report</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <propertyName>jacoco.agent.argLine</propertyName><!-- used for surefire/failsafe-plugin combination -->
                    <destfile></destfile>
                </configuration>
            </plugin>
            <!-- /Code-coverage with jacoco -->
            
            <!-- unit-tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${version.maven-surefire-plugin}</version>
                <configuration>
                    <!-- <skipTests>true</skipTests> -->
                    <argLine>${jacoco.agent.argLine},destfile=${sonar.jacoco.reportPath}</argLine>
                    <includes>
                        <include>**/unittest/*.java</include>
                        <include>**/unittest/**/*.java</include>
                    </includes>
                    <excludes>
                        <exclude>**/integration/*.java</exclude>
                        <exclude>**/integration/**/*.java</exclude>
                        <exclude>**/functional/*.java</exclude>
                        <exclude>**/functional/**/*.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- /unit-tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>${version.java.source}</source>
                    <target>${version.java.target}</target>
                    <compilerArgument>-Xlint:unchecked</compilerArgument>
                </configuration>
            </plugin>
        </plugins>
    </build>
    
    <profiles>
        <profile>
            <id>generate-sources</id>
            <activation>
                <property>
                    <name>withSrc</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- add sources for maven-central via OSSRH/Sonatype -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>generate-javadoc</id>
            <activation>
                <property>
                    <name>withDoc</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- add javadoc for maven-central via OSSRH/Sonatype -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.3</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>generate-signed-files</id>
            <activation>
                <property>
                    <name>doSign</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- sign stuff for maven-central via OSSRH/Sonatype -->
                    <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>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>release-to-ossrh</id>
            <activation>
                <property>
                    <name>doRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.5</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
