<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright 2016-2017 Testify Project.

    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>org.testifyproject.buildtools</groupId>
    <artifactId>parent</artifactId>
    <version>0.9.2</version>
    <packaging>pom</packaging>

    <name>Build Tools</name>
    <description>A set of tools for managing code quality and builds</description>
    <url>https://github.com/testify-project/build-tools</url>
    
    <modules>
        <module>coding-conventions</module>
        <module>maven</module>
        <module>external</module>
        <module>tools</module>
    </modules>

    <properties>
        <!-- Build Properties -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.version>3.0.5</maven.version>

        <!-- IDE Properties -->
        <netbeans.compile.on.save>none</netbeans.compile.on.save>
        <netbeans.checkstyle.format>true</netbeans.checkstyle.format>
        <netbeans.hint.license>apache20</netbeans.hint.license>
        <netbeans.hint.license.inceptionYear>2016</netbeans.hint.license.inceptionYear>

        <!-- Test Dependency Versions -->
        <junit.version>4.12</junit.version>
        <testng.version>6.9.10</testng.version>
        <mockito.version>2.6.2</mockito.version>
        <assertj.version>3.5.2</assertj.version>

        <!-- Plugin Dependency Versions -->
        <plugin.enforcer>1.4.1</plugin.enforcer>
        <plugin.compiler>3.3</plugin.compiler>
        <plugin.surefire>2.19.1</plugin.surefire>
        <plugin.source>2.4</plugin.source>
        <plugin.javadoc>2.10.3</plugin.javadoc>
        <plugin.gpg>1.6</plugin.gpg>
        <plugin.versions>2.2</plugin.versions>
        <plugin.sonatype>1.6.7</plugin.sonatype>
        <plugin.checkstyle>2.17</plugin.checkstyle>
        <plugin.license>3.0</plugin.license>
        <plugin.jacoco>0.7.7.201606060606</plugin.jacoco>
        <plugin.shade>2.4.3</plugin.shade>
    </properties>

    <prerequisites>
        <maven>${maven.version}</maven>
    </prerequisites>

    <inceptionYear>2016</inceptionYear>

    <organization>
        <name>Testify Project</name>
        <url>https://github.com/testify-project/build-tools</url>
    </organization>

    <developers>
        <developer>
            <id>saden1</id>
            <name>Sharmarke Aden</name>
            <timezone>-8</timezone>
            <url>https://github.com/saden1</url>
            <roles>
                <role>Founder</role>
            </roles>
        </developer>
    </developers>

    <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</system>
        <url>https://github.com/testify-project/build-tools/issues</url>
    </issueManagement>

    <scm>
        <connection>scm:git:https://github.com/testify-project/build-tools.git</connection>
        <developerConnection>scm:git:https://github.com/testify-project/build-tools.git</developerConnection>
        <url>https://github.com/testify-project/build-tools.git/tree/${project.scm.tag}</url>
        <tag>master</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>

    <repositories>
        <repository>
            <id>oss.sonatype.org snapshot</id>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
        <repository>
            <id>oss.sonatype.org releases</id>
            <url>http://oss.sonatype.org/content/repositories/releases</url>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </releases>
            <snapshots>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-enforcer-plugin</artifactId>
                    <version>${plugin.enforcer}</version>
                    <executions>
                        <execution>
                            <id>enforce-versions</id>
                            <goals>
                                <goal>enforce</goal>
                            </goals>
                            <configuration>
                                <rules>
                                    <requireMavenVersion>
                                        <version>[${maven.version},)</version>
                                    </requireMavenVersion>
                                    <requireJavaVersion>
                                        <version>${maven.compiler.target}</version>
                                    </requireJavaVersion>
                                    <requireProperty>
                                        <property>project.build.sourceEncoding</property>
                                        <regex>${project.build.sourceEncoding}</regex>
                                    </requireProperty>
                                </rules>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>${plugin.checkstyle}</version>
                    <executions>
                        <execution>
                            <id>checkstyle-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.testifyproject.buildtools</groupId>
                            <artifactId>coding-conventions</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <configLocation>custom_checkstyle.xml</configLocation>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${plugin.license}</version>
                    <executions>
                        <execution>
                            <id>license-check</id>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.testifyproject.buildtools</groupId>
                            <artifactId>coding-conventions</artifactId>
                            <version>${project.version}</version>
                        </dependency>
                    </dependencies>
                    <configuration>
                        <header>license.txt</header>
                        <headerDefinitions>
                            <headerDefinition>java_header_style.xml</headerDefinition>
                        </headerDefinitions>
                        <excludes>
                            <exclude>**/.*</exclude>
                            <exclude>**/*.md</exclude>
                            <exclude>**/*.txt</exclude>
                            <exclude>**/*.gpg</exclude>
                            <exclude>**/*.enc</exclude>
                            <exclude>**/*.tar</exclude>
                            <exclude>**/*.sh</exclude>
                            <exclude>**/settings.xml</exclude>
                            <exclude>**/nbactions.xml</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>src/test/resources/**</exclude>
                            <exclude>src/main/resources/**</exclude>
                            <exclude>nbproject/**</exclude>
                            <exclude>archetype.properties</exclude>
                            <exclude>pom.xml.*</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${plugin.compiler}</version>
                    <configuration>
                        <debug>true</debug>
                        <debuglevel>lines,vars</debuglevel>
                        <compilerArguments>
                            <parameters />
                        </compilerArguments>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${plugin.surefire}</version>
                    <configuration>
                        <argLine>${jacocoSurefireArgs} -client -Xms512m -Xmx2048m</argLine>
                        <forkCount>1</forkCount>
                        <reuseForks>true</reuseForks>
                        <parallel>classesAndMethods</parallel>
                        <useUnlimitedThreads>true</useUnlimitedThreads>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${plugin.jacoco}</version>
                    <executions>
                        <execution>
                            <id>jacoco-prepare-agent</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                            <configuration>
                                <propertyName>jacocoSurefireArgs</propertyName>
                            </configuration>
                        </execution>
                        <execution>
                            <id>jacoco-report</id>
                            <goals>
                                <goal>report</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${plugin.source}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>${plugin.javadoc}</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>${plugin.gpg}</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>${plugin.sonatype}</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                        <description>${project.version}</description>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <!-- Default Development Profile -->
        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <configuration>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <skip>${skipTests}</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Quick Validation Profile -->
        <profile>
            <id>validate</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Build Profile -->
        <profile>
            <id>build</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Staging Profile -->
        <profile>
            <id>stage</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Release Profile -->
        <profile>
            <id>release</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <!--
                                Don't include debug information in released
                                builds but do include parameter names.
                            -->
                            <debug>false</debug>
                            <compilerArguments>
                                <parameters />
                            </compilerArguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <configuration>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>