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

    <!--
        To perform a full release with a deploy to Maven Central, ensure gpg-agent is running and then:

        mvn clean deploy -P release-sign-artifacts -Dgpg.keyname='<keyname>'
    -->

    <modelVersion>4.0.0</modelVersion>

    <groupId>org.t3as</groupId>
    <artifactId>t3as-snomedct-service</artifactId>
    <version>1.3.4</version>
    <packaging>pom</packaging>

    <name>NICTA t3as SNOMED CT Service</name>
    <description>Find the SNOMED CT concepts in clinical text.</description>
    <url>http://t3as.org/</url>
    <inceptionYear>2014</inceptionYear>
    <organization>
        <name>NICTA</name>
        <url>http://nicta.com.au/</url>
    </organization>
    <developers>
        <developer>
            <name>Mats Henrikson</name>
            <email>mats.henrikson@nicta.com.au</email>
            <organization>NICTA</organization>
            <organizationUrl>http://nicta.com.au/</organizationUrl>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>GNU GENERAL PUBLIC LICENSE Version 3</name>
            <url>http://www.gnu.org/licenses/gpl-3.0.txt</url>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:https://github.com/NICTA/t3as-snomedct-service.git</connection>
        <developerConnection>scm:git:https://github.com/NICTA/t3as-snomedct-service.git</developerConnection>
        <url>https://github.com/NICTA/t3as-snomedct-service</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.rootdir>${basedir}</project.rootdir>
        <maven-notice-plugin.version>1.0.6.1</maven-notice-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.2</nexus-staging-maven-plugin.version>
        <com.sun.jersey.version>1.18.1</com.sun.jersey.version>
        <com.beust.jcommander.version>1.35</com.beust.jcommander.version>
    </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>
        <defaultGoal>install</defaultGoal>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-install-plugin</artifactId>
                <version>2.5.1</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>1.7</version>
                <configuration>
                    <licenseName>gpl_v3_specified_lib_exceptions</licenseName>
                    <licenseResolver>file:${project.rootdir}/licensing</licenseResolver>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>update-file-header</goal>
                        </goals>
                        <phase>process-sources</phase>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jasig.maven</groupId>
                <artifactId>maven-notice-plugin</artifactId>
                <version>${maven-notice-plugin.version}</version>
                <configuration>
                    <generateChildNotices>true</generateChildNotices>
                    <noticeTemplate>${project.rootdir}/licensing/notice-template</noticeTemplate>
                    <licenseMapping>
                        <param>${project.rootdir}/licensing/license-mappings.xml</param>
                    </licenseMapping>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>

            <!-- when adding/removing modules don't forget to do the same in the other profiles -->
            <modules>
                <module>snomed-coder-common</module>
                <module>metamap-tagger</module>
                <module>snomedct-lookup</module>
                <module>snomed-coder-web</module>
                <module>snomed-coder-ui-web</module>
                <module>snomed-coder-client</module>
            </modules>

            <build>
                <plugins>

                    <!-- to deploy a release to Maven Central run with the release-sign-artifacts profile -->
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>${nexus-staging-maven-plugin.version}</version>
                        <executions> <execution> <phase>none</phase> </execution> </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>

        <profile>
            <id>release-sign-artifacts</id>

            <!-- when adding/removing modules don't forget to do the same in the other profiles -->
            <modules>
                <module>snomed-coder-common</module>
                <module>metamap-tagger</module>
                <module>snomedct-lookup</module>
                <module>snomed-coder-client</module>
                <!-- excluding the WAR modules -->
            </modules>

            <properties>
                <gpg.executable>gpg2</gpg.executable>
            </properties>
            <build>
                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                            </archive>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.9.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <quiet>true</quiet>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                            </archive>
                        </configuration>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</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>${nexus-staging-maven-plugin.version}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>

                    <!-- don't run notice plugin since the root notice will be messed up due to 'missing' modules -->
                    <plugin>
                        <groupId>org.jasig.maven</groupId>
                        <artifactId>maven-notice-plugin</artifactId>
                        <version>${maven-notice-plugin.version}</version>
                        <executions> <execution> <phase>none</phase> </execution> </executions>
                    </plugin>

                </plugins>
            </build>
        </profile>
    </profiles>

</project>
