<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2016 Richard Burrow (https://github.com/codeframes)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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.codeframes</groupId>
    <artifactId>hal-tooling</artifactId>
    <packaging>pom</packaging>
    <version>1.0.0</version>

    <name>HAL Tooling</name>
    <description>Parent pom for HAL Tooling project modules.</description>
    <url>https://github.com/codeframes/hal-tooling</url>
    <inceptionYear>2016</inceptionYear>

    <organization>
        <name>Code:Frames</name>
        <url>https://github.com/codeframes</url>
    </organization>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <url>https://github.com/codeframes/hal-tooling</url>
        <connection>scm:git:git://github.com/codeframes/hal-tooling.git</connection>
        <developerConnection>scm:git:git://github.com/codeframes/hal-tooling.git</developerConnection>
        <tag>v1.0.0</tag>
    </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>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/codeframes/hal-tooling/issues</url>
    </issueManagement>

    <developers>
        <developer>
            <name>Richard Burrow</name>
            <email>rojb@hotmail.co.uk</email>
        </developer>
    </developers>

    <prerequisites>
        <maven>3.0.5</maven>
    </prerequisites>

    <modules>
        <module>hal-tooling-core</module>
        <module>hal-tooling-json</module>
        <module>hal-tooling-link-bindings</module>
        <module>hal-tooling-link-bindings-jax-rs</module>
        <module>hal-tooling-test</module>
    </modules>

    <properties>
        <java.version>1.7</java.version>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

        <coverage-reports.directory>${project.build.directory}/coverage-reports</coverage-reports.directory>
        <jacoco.ut.output>${coverage-reports.directory}/jacoco-ut.exec</jacoco.ut.output>
        <jacoco.it.output>${coverage-reports.directory}/jacoco-it.exec</jacoco.it.output>

        <sonar.jacoco.reportPath>${jacoco.ut.output}</sonar.jacoco.reportPath>
        <sonar.jacoco.itReportPath>${jacoco.it.output}</sonar.jacoco.itReportPath>

        <!-- Dependency Versioning -->
        <jackson.version>2.6.1</jackson.version>
        <snakeyaml.version>1.15</snakeyaml.version>

        <!-- Test Dependency Versioning -->
        <cglib-nodep.version>3.2.0</cglib-nodep.version>
        <hamcrest-all.version>1.3</hamcrest-all.version>
        <equalsverifier.version>2.0.2</equalsverifier.version>
        <groovy-all.version>2.4.5</groovy-all.version>
        <jmockit.version>1.29</jmockit.version>
        <junit.version>4.12</junit.version>
        <objenesis.version>2.2</objenesis.version>
        <spock-core.version>1.0-groovy-2.4</spock-core.version>

        <!-- Core Plugin Versioning -->
        <maven-clean-plugin.version>3.0.0</maven-clean-plugin.version>
        <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
        <maven-failsafe-plugin.version>2.19</maven-failsafe-plugin.version>
        <maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
        <maven-install-plugin.version>2.5.2</maven-install-plugin.version>
        <maven-javadoc-plugin.version>2.10.4</maven-javadoc-plugin.version>
        <maven-site-plugin.version>3.4</maven-site-plugin.version>
        <maven-source-plugin.version>3.0.1</maven-source-plugin.version>
        <maven-surefire-plugin.version>2.19</maven-surefire-plugin.version>

        <!-- 3rd Party Plugin Versioning -->
        <build-helper-maven-plugin.version>1.10</build-helper-maven-plugin.version>
        <gmavenplus-plugin.version>1.5</gmavenplus-plugin.version>
        <jacoco-maven-plugin.version>0.7.5.201505241946</jacoco-maven-plugin.version>
        <license-maven-plugin.version>3.0.rc1</license-maven-plugin.version>
        <nexus-staging-maven-plugin.version>1.6.7</nexus-staging-maven-plugin.version>
        <sonar-maven-plugin.version>2.7.1</sonar-maven-plugin.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson.version}</version>
            </dependency>

            <dependency>
                <groupId>org.yaml</groupId>
                <artifactId>snakeyaml</artifactId>
                <version>${snakeyaml.version}</version>
            </dependency>

            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>3.0.1</version>
                <scope>provided</scope>
            </dependency>

            <!-- Test Dependencies -->
            <dependency>
                <groupId>org.jmockit</groupId>
                <artifactId>jmockit</artifactId>
                <version>${jmockit.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>${hamcrest-all.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>nl.jqno.equalsverifier</groupId>
                <artifactId>equalsverifier</artifactId>
                <version>${equalsverifier.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>${groovy-all.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.spockframework</groupId>
                <artifactId>spock-core</artifactId>
                <version>${spock-core.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- enables mocking of classes (in addition to interfaces) -->
            <dependency>
                <groupId>cglib</groupId>
                <artifactId>cglib-nodep</artifactId>
                <version>${cglib-nodep.version}</version>
                <scope>test</scope>
            </dependency>

            <!-- enables mocking of classes without default constructor (together with CGLIB) -->
            <dependency>
                <groupId>org.objenesis</groupId>
                <artifactId>objenesis</artifactId>
                <version>${objenesis.version}</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-groovy-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/groovy</source>
                            </sources>
                        </configuration>
                    </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>false</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!--
                Maven Core Plugins
                -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin.version}</version>
                </plugin>

                <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>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>${maven-failsafe-plugin.version}</version>
                    <executions>
                        <!--
                            Ensures that both integration-test and verify goals of the Failsafe Maven
                            plugin are executed.
                        -->
                        <execution>
                            <id>integration-tests</id>
                            <goals>
                                <goal>integration-test</goal>
                                <goal>verify</goal>
                            </goals>
                            <configuration>
                                <includes>
                                    <include>**/*ITest.class</include>
                                </includes>
                                <!-- Sets the VM argument line used when integration tests are run. -->
                                <!--suppress MavenModelInspection -->
                                <argLine>${failsafeArgLine}</argLine>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin.version}</version>
                    <configuration>
                        <!-- Sets the VM argument line used when unit tests are run. -->
                        <!--suppress MavenModelInspection -->
                        <argLine>${surefireArgLine}</argLine>
                        <!-- Excludes integration tests when unit tests are run. -->
                        <excludes>
                            <exclude>**/*ITest.class</exclude>
                        </excludes>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin.version}</version>
                    <configuration>
                        <createChecksum>true</createChecksum>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${maven-javadoc-plugin.version}</version>
                    <configuration>
                        <encoding>${project.reporting.outputEncoding}</encoding>
                        <source>${java.version}</source>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>${maven-site-plugin.version}</version>
                </plugin>

                <!--
                3rd Party Plugins
                -->
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>${build-helper-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.gmavenplus</groupId>
                    <artifactId>gmavenplus-plugin</artifactId>
                    <version>${gmavenplus-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>testCompile</goal>
                            </goals>
                            <configuration>
                                <testSources>
                                    <testSource>
                                        <directory>${project.basedir}/src/test/groovy</directory>
                                        <includes>
                                            <include>**/*.groovy</include>
                                        </includes>
                                    </testSource>
                                    <testSource>
                                        <directory>${project.basedir}/src/itest/groovy</directory>
                                        <includes>
                                            <include>**/*.groovy</include>
                                        </includes>
                                    </testSource>
                                </testSources>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${jacoco-maven-plugin.version}</version>
                    <executions>
                        <!--
                            Prepares the property pointing to the JaCoCo runtime agent which
                            is passed as VM argument when Maven the Surefire plugin is executed.
                        -->
                        <execution>
                            <id>pre-unit-test</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->
                                <destFile>${jacoco.ut.output}</destFile>
                                <!--
                                    Sets the name of the property containing the settings
                                    for JaCoCo runtime agent.
                                -->
                                <propertyName>surefireArgLine</propertyName>
                            </configuration>
                        </execution>
                        <!--
                            Ensures that the code coverage report for unit tests is created after
                            unit tests have been run.
                        -->
                        <execution>
                            <id>post-unit-test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->
                                <dataFile>${jacoco.ut.output}</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                            </configuration>
                        </execution>
                        <!--
                            Prepares the property pointing to the JaCoCo runtime agent which
                            is passed as VM argument when Maven the Failsafe plugin is executed.
                        -->
                        <execution>
                            <id>pre-integration-test</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->
                                <destFile>${jacoco.it.output}</destFile>
                                <!--
                                    Sets the name of the property containing the settings
                                    for JaCoCo runtime agent.
                                -->
                                <propertyName>failsafeArgLine</propertyName>
                            </configuration>
                        </execution>
                        <!--
                            Ensures that the code coverage report for integration tests after
                            integration tests have been run.
                        -->
                        <execution>
                            <id>post-integration-test</id>
                            <phase>post-integration-test</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <!-- Sets the path to the file which contains the execution data. -->
                                <dataFile>${jacoco.it.output}</dataFile>
                                <!-- Sets the output directory for the code coverage report. -->
                                <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven-plugin.version}</version>
                    <configuration>
                        <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                        <mapping>
                            <java>SLASHSTAR_STYLE</java>
                            <groovy>SLASHSTAR_STYLE</groovy>
                        </mapping>
                        <properties>
                            <owner>Richard Burrow</owner>
                            <email>${project.organization.url}</email>
                        </properties>
                        <excludes>
                            <exclude>README.md</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>src/main/resources/**</exclude>
                            <exclude>src/test/resources/**</exclude>
                            <exclude>src/itest/resources/**</exclude>
                        </excludes>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${sonar-maven-plugin.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${maven-gpg-plugin.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.mycila</groupId>
                        <artifactId>license-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>license-header-check</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>