<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.dellroad</groupId>
    <artifactId>hl7lib</artifactId>
    <name>HL7Lib</name>
    <version>1.2.0</version>
    <description>Lightweight Java library for HL7 messages </description>
    <url>https://github.com/archiecobbs/hl7lib</url>
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <issueManagement>
        <system>GitHub Issues</system>
        <url>https://github.com/archiecobbs/hl7lib/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/archiecobbs/hl7lib/</url>
        <connection>scm:git:git://github.com/archiecobbs/hl7lib.git</connection>
        <developerConnection>scm:git:git://github.com/archiecobbs/hl7lib.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>archie</id>
            <name>Archie Cobbs</name>
            <email>archie.cobbs@gmail.com</email>
        </developer>
    </developers>
    <properties>

        <!-- Basic stuff -->
        <compiler.source>1.8</compiler.source>
        <compiler.target>1.8</compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <checkstyle.config.location>src/checkstyle/checkstyle.xml</checkstyle.config.location>

        <!-- Dependency versions -->
        <dellroad-stuff.version>2.2.3</dellroad-stuff.version>
        <findbugs.version>3.0.2</findbugs.version>
        <maven.checkstyle.plugin.version>3.0.0</maven.checkstyle.plugin.version>
        <maven.compiler.plugin.version>3.7.0</maven.compiler.plugin.version>
        <maven.enforcer.plugin.version>3.0.0-M1</maven.enforcer.plugin.version>
        <maven.gpg.plugin.version>1.6</maven.gpg.plugin.version>
        <maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
        <maven.javadoc.plugin.version>3.0.0</maven.javadoc.plugin.version>
        <maven.project.info.reports.plugin.version>2.9</maven.project.info.reports.plugin.version>
        <maven.source.plugin.version>3.0.1</maven.source.plugin.version>
        <maven.surefire.plugin.version>2.21.0</maven.surefire.plugin.version>
        <properties.maven.plugin.version>1.0.0</properties.maven.plugin.version>
        <spotbugs.maven.plugin.version>3.1.3</spotbugs.maven.plugin.version>
        <spotbugs.maven.plugin.version>3.1.3</spotbugs.maven.plugin.version>
        <spotbugs.version>3.1.2</spotbugs.version>
        <testng.version>6.14.2</testng.version>
        <testng.version>6.14.2</testng.version>

    </properties>
    <dependencies>

        <!-- FindBugs annotations - not needed at runtime -->
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <version>${findbugs.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- DellRoad Stuff -->
        <dependency>
            <groupId>org.dellroad</groupId>
            <artifactId>dellroad-stuff-main</artifactId>
            <version>${dellroad-stuff.version}</version>
            <scope>test</scope>
        </dependency>

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

    <distributionManagement>
        <downloadUrl>https://github.com/archiecobbs/hl7lib</downloadUrl>
        <snapshotRepository>
            <id>sonatype-nexus-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>sonatype-nexus-staging</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
        <site>
            <id>${project.artifactId}-site</id>
            <url>file://${project.basedir}/site/</url>
        </site>
    </distributionManagement>

    <build>
        <plugins>

            <!-- Avoid Mac OS X "Launcher" application appearing during build -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <version>${properties.maven.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>set-system-properties</goal>
                        </goals>
                        <configuration>
                            <properties>
                                <property>
                                    <name>java.awt.headless</name>
                                    <value>true</value>
                                </property>
                            </properties>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Java version enforcer -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven.enforcer.plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <version>1.8.0</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>${maven.jar.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

            <!-- Compile -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${compiler.source}</source>
                    <target>${compiler.target}</target>
                    <showWarnings>true</showWarnings>
                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                        <arg>-Werror</arg>
                    </compilerArgs>
                </configuration>
            </plugin>

            <!-- Sources -->
            <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</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <configuration>
                    <notimestamp>true</notimestamp>
                    <validateLinks>true</validateLinks>
                    <links>
                        <link>http://archiecobbs.github.io/dellroad-stuff/site/apidocs/</link>
                    </links>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven.surefire.plugin.version}</version>
                <configuration>
                    <systemPropertyVariables>
                        <deleteTempDirs>true</deleteTempDirs>
                        <randomSeed/>
                    </systemPropertyVariables>
                    <properties>
                        <property>
                            <name>surefire.testng.verbose</name>
                            <value>10</value>
                        </property>
                    </properties>
                </configuration>
            </plugin>

            <!-- Checkstyle -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${maven.checkstyle.plugin.version}</version>
                <executions>
                    <execution>
                        <id>default-verify</id>
                        <phase>verify</phase>
                        <configuration>
                            <encoding>UTF-8</encoding>
                            <consoleOutput>true</consoleOutput>
                            <failsOnError>true</failsOnError>
                            <linkXRef>false</linkXRef>
                            <sourceDirectories>
                                <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
                                <sourceDirectory>${project.build.testSourceDirectory}</sourceDirectory>
                            </sourceDirectories>
                        </configuration>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- SpotBugs -->
            <plugin>
                <groupId>com.github.spotbugs</groupId>
                <artifactId>spotbugs-maven-plugin</artifactId>
                <version>${spotbugs.maven.plugin.version}</version>
                <configuration>
                    <effort>Max</effort>
                    <threshold>Default</threshold>
                    <xmlOutput>true</xmlOutput>
                    <findbugsXmlOutput>true</findbugsXmlOutput>
                    <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
                    <excludeFilterFile>src/spotbugs/spotbugs-exclude.xml</excludeFilterFile>
                    <failOnError>true</failOnError>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Info Reports -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>${maven.project.info.reports.plugin.version}</version>
            </plugin>
        </plugins>

    </build>
    <reporting>
        <plugins>

            <!-- Javadoc -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven.javadoc.plugin.version}</version>
                <inherited>false</inherited>
                <configuration>
                    <notimestamp>true</notimestamp>
                    <links/>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
    <profiles>

        <!-- Maven Central requires signed artifacts -->
        <profile>
            <id>sign</id>
            <build>
                <plugins>
                    <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>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
