<?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>com.github.goldin</groupId>
    <artifactId>main.plugins</artifactId>
    <packaging>pom</packaging>
    <version>0.2.5</version>
    <name>[${project.groupId}:${project.artifactId}:${project.version}]</name>
    <description>Maven plugins</description>
    <url>http://evgeny-goldin.com/wiki/Maven-plugins</url>

    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <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>

    <scm>
        <connection>scm:git:git@github.com:evgeny-goldin/maven-plugins.git</connection>
        <developerConnection>scm:git:git@github.com:evgeny-goldin/maven-plugins.git</developerConnection>
        <url>git@github.com:evgeny-goldin/maven-plugins.git</url>
    </scm>

    <developers>
        <developer>
            <id>evgenyg</id>
            <name>Evgeny Goldin</name>
            <email>evgenyg@gmail.com</email>
        </developer>
    </developers>

    <properties>

        <!-- ~~~~~~~~~~~~~~~~ -->
        <!-- Library versions -->
        <!-- ~~~~~~~~~~~~~~~~ -->

        <maven-version>3.0.4</maven-version>
        <java-version>1.6</java-version>
        <previous-plugins-version>0.2.4</previous-plugins-version>
        <gcommons-version>0.5.4</gcommons-version>
        <groovy-version>1.8.6</groovy-version>
        <gmaven-version>1.4</gmaven-version>
        <annomojo-version>1.4.1</annomojo-version>
        <spring-version>3.1.1.RELEASE</spring-version>
        <spring-batch-version>2.1.8.RELEASE</spring-batch-version>
        <junit-version>4.10</junit-version>
        <ant-version>1.8.3</ant-version>
        <gcontracts-version>1.2.5</gcontracts-version>
        <aether-version>1.13.1</aether-version>
    </properties>


    <modules>

        <!-- ~~~~~ -->
        <!-- Infra -->
        <!-- ~~~~~ -->

        <module>maven-common</module>
        <module>mojo-parent</module>

        <!-- ~~~~~~~~~~~~~ -->
        <!-- Maven Plugins -->
        <!-- ~~~~~~~~~~~~~ -->

        <module>duplicates-finder-plugin</module>
        <module>ivy-maven-plugin</module>
        <module>about-maven-plugin</module>
        <module>copy-maven-plugin</module>
        <module>jenkins-maven-plugin</module>
        <module>assert-maven-plugin</module>
        <module>mail-maven-plugin</module>
        <module>find-maven-plugin</module>
        <module>timestamp-maven-plugin</module>
        <module>properties-maven-plugin</module>
        <module>sshexec-maven-plugin</module>
        <module>spring-batch-maven-plugin</module>
    </modules>


    <dependencies>
        <!-- Occasionally required for Groovy compilation -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit-version}</version>
            <scope>compile</scope>
            <exclusions>
                <!-- Duplicate of JUnit itself -->
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>


    <build>
        <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
        <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>

        <resources>
            <resource>
                <directory>${project.basedir}/src/main/resources</directory>
            </resource>
        </resources>

        <testResources>
            <testResource>
                <directory>${project.basedir}/src/test/resources</directory>
            </testResource>
        </testResources>


        <pluginManagement>
            <plugins>

                <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                <!-- Configuring default compilation options                                       -->
                <!-- http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html       -->
                <!-- http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/ -->
                <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <source>${java-version}</source>
                        <target>${java-version}</target>
                        <compilerArgument>-Xlint:all</compilerArgument>
                        <encoding>UTF-8</encoding>
                        <showDeprecation>true</showDeprecation>
                        <showWarnings>true</showWarnings>
                    </configuration>
                </plugin>

                <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                <!-- AnnoMojo: http://wiki.jfrog.org/confluence/display/OSS/Maven+Anno+Mojo      -->
                <!-- http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugin-plugin/ -->
                <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>2.9</version>
                    <dependencies>
                        <dependency>
                          <groupId>org.apache.maven.plugin-tools</groupId>
                          <artifactId>maven-plugin-tools-api</artifactId>
                          <version>2.9</version>
                        </dependency>
                        <dependency>
                        <!-- http://evgeny-goldin.org/youtrack/issue/pl-632 -->
                            <groupId>br.com.ingenieux.maven.annomojo</groupId>
                            <artifactId>org.jfrog.maven.maven-plugin-tools-anno</artifactId>
                            <version>${annomojo-version}</version>
                            <scope>runtime</scope>
                        </dependency>
                    </dependencies>
                </plugin>

                <!-- ~~~~~~~~~~~~~ -->
                <!-- GMaven plugin -->
                <!-- ~~~~~~~~~~~~~ -->

                <plugin>
                    <groupId>org.codehaus.gmaven</groupId>
                    <artifactId>gmaven-plugin</artifactId>
                    <version>${gmaven-version}</version>
                    <configuration>
                        <providerSelection>1.8</providerSelection>
                        <source />
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.codehaus.gmaven.runtime</groupId>
                            <artifactId>gmaven-runtime-1.8</artifactId>
                            <version>${gmaven-version}</version>
                            <exclusions>
                                <exclusion>
                                    <groupId>org.codehaus.groovy</groupId>
                                    <artifactId>groovy-all</artifactId>
                                </exclusion>
                            </exclusions>
                        </dependency>
                        <dependency>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy-all</artifactId>
                            <version>${groovy-version}</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.ant</groupId>
                            <artifactId>ant</artifactId>
                            <version>${ant-version}</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                <!-- Configuring surefire plugin to display test errors in console                 -->
                <!-- http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/ -->
                <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.12</version>
                    <configuration>
                        <useFile>false</useFile>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>junit</groupId>
                            <artifactId>junit</artifactId>
                            <version>${junit-version}</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>


        <plugins>

            <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
            <!-- Enforcing Maven/Java versions                                                 -->
            <!-- http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-enforcer-plugin/ -->
            <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.0.1</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>maven-enforcer</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
                <configuration>
                    <rules>
                        <requireMavenVersion>
                            <version>${maven-version}</version>
                        </requireMavenVersion>
                        <requireJavaVersion>
                            <version>${java-version}</version>
                        </requireJavaVersion>
                    </rules>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>${gmaven-version}</version>
                <executions>
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <!-- Displaying Maven progress report in TeamCity -->
                    <!-- http://goo.gl/Imrm6                          -->
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <execution>
                        <id>display-progress-report</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                if ( System.getProperty( 'teamcity.version' ))
                                {
                                    println "##teamcity[progressMessage '${project.groupId}:${project.artifactId}']"
                                }
                            </source>
                        </configuration>
                    </execution>
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <!-- Compiling Groovy sources and tests                               -->
                    <!-- http://docs.codehaus.org/display/GMAVEN/Building+Groovy+Projects -->
                    <!-- http://docs.codehaus.org/display/GMAVEN/Executing+Groovy+Code    -->
                    <!-- http://permalink.gmane.org/gmane.comp.lang.groovy.user/47119     -->
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <execution>
                        <id>compile-groovy</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <fileset>
                                    <directory>${pom.basedir}/src/main/groovy</directory>
                                    <includes>
                                        <include>**/*.groovy</include>
                                    </includes>
                                </fileset>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile-groovy-tests</id>
                        <phase>test-compile</phase>
                        <goals>
                            <goal>testCompile</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <fileset>
                                    <directory>${pom.basedir}/src/test/groovy</directory>
                                    <includes>
                                        <include>**/*.groovy</include>
                                    </includes>
                                </fileset>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>


    <profiles>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Profile adding additional release files  -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

        <profile>
            <id>addFiles</id>
            <modules>
                <module>groovydoc</module>
            </modules>
            <build>
                <plugins>

                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <!-- Copying "license.txt" and "README.txt" files to ${project.build.outputDirectory} -->
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

                    <plugin>
                        <groupId>com.github.goldin</groupId>
                        <artifactId>copy-maven-plugin</artifactId>
                        <version>${previous-plugins-version}</version>
                        <executions>
                            <execution>
                                <id>copy-license-readme</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <runIf>{{ new File( project.build.outputDirectory ).directory }}</runIf>
                                    <resources>
                                        <resource>
                                            <targetPath>${project.build.outputDirectory}</targetPath>
                                            <file>${project.basedir}/../license.txt</file>
                                        </resource>
                                        <resource>
                                            <targetPath>${project.build.outputDirectory}</targetPath>
                                            <file>${project.basedir}/README.txt</file>
                                            <failIfNotFound>false</failIfNotFound>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <!-- Copying "about.txt" to ${project.build.outputDirectory} -->
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

                    <plugin>
                        <groupId>com.github.goldin</groupId>
                        <artifactId>about-maven-plugin</artifactId>
                        <version>${previous-plugins-version}</version>
                        <executions>
                            <execution>
                                <id>copy-about</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>create-about</goal>
                                </goals>
                                <configuration>
                                    <runIf>{{ new File( project.build.outputDirectory ).directory }}</runIf>
                                    <dumpDependencies>true</dumpDependencies>
                                    <dumpMaven>true</dumpMaven>
                                    <fileName>${project.build.outputDirectory}/about~${project.groupId}~${project.artifactId}~${project.version}.txt</fileName>
                                    <updateArchives>false</updateArchives>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
                    <!-- Creating sources and Javadoc archives -->
                    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.1.2</version>
                        <executions>
                            <execution>
                                <id>pack-sources</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>**/*.java</include>
                                        <include>**/*.groovy</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.8.1</version>
                        <executions>
                            <execution>
                                <id>pack-javadoc</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
        <!-- Profile checking for duplicate libraries in scopes -->
        <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

        <profile>
            <id>duplicates</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.goldin</groupId>
                        <artifactId>duplicates-finder-plugin</artifactId>
                        <version>${previous-plugins-version}</version>
                        <executions>
                            <execution>
                                <id>find-duplicates</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>find-duplicates</goal>
                                </goals>
                                <configuration>
                                    <verbose>false</verbose>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
