<?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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.groupbyinc</groupId>
    <artifactId>parent-oss</artifactId>
    <version>2</version>
  </parent>

  <artifactId>common</artifactId>
  <version>21</version>

  <packaging>pom</packaging>

  <name>GroupBy - Common</name>
  <description>${project.name}</description>

  <modules>
    <module>jackson</module>
    <module>http</module>
    <module>net</module>
    <module>utils</module>
    <module>test</module>
    <module>lifecycle</module>
  </modules>

  <scm>
    <url>https://github.com/groupby/common</url>
    <connection>scm:git:git@github.com:groupby/common.git</connection>
    <developerConnection>scm:git:git@github.com:groupby/common.git</developerConnection>
    <tag>common-v21</tag>
  </scm>

  <properties>

    <!-- # Build params-->
    <project.build.jdkVersion>1.6</project.build.jdkVersion>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <project.build.locale>en_US</project.build.locale>
    <repo.upload.retryAttempts>3</repo.upload.retryAttempts>

    <!-- # Test params -->
    <test.slow>false</test.slow>
    <test.runOrder>random</test.runOrder>
    <test.forkCount>0.5C</test.forkCount>
    <test.reuseForks>true</test.reuseForks>
    <test.threadLocal>false</test.threadLocal>
    <test.threadCount />
    <test.parallel />
    <log4j.properties />

  </properties>

  <build>

    <resources>

      <!-- ### Filtered Resources -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>log4j.xml</include>
          <include>**/*.properties</include>
        </includes>
      </resource>

      <!-- ### Unfiltered Resources -->
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>log4j.xml</exclude>
          <exclude>**/*.properties</exclude>
        </excludes>
      </resource>

    </resources>

    <testResources>

      <!-- ### Filtered Resources -->
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>log4j.xml</include>
          <include>**/*.properties</include>
        </includes>
      </testResource>

      <!-- ### Unfiltered Resources -->
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>log4j.xml</exclude>
          <exclude>**/*.properties</exclude>
        </excludes>
      </testResource>

    </testResources>

    <pluginManagement>

      <plugins>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.2</version>
          <configuration>
            <source>${project.build.jdkVersion}</source>
            <target>${project.build.jdkVersion}</target>
            <compilerVersion>${project.build.jdkVersion}</compilerVersion>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.4</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.5</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.6</version>
          <configuration>
            <filesets>
              <fileset>
                <directory>${project.basedir}</directory>
                <includes>
                  <include>dependency-reduced-pom.xml</include>
                </includes>
              </fileset>
            </filesets>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>2.9</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.7</version>
          <configuration>
            <encoding>${project.build.sourceEncoding}</encoding>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>2.3</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.4.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.5</version>
          <configuration>
            <forceCreation>true</forceCreation>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <packageName />
              </manifest>
              <manifestEntries>
                <Jdk-Compatibility-Version>${project.build.jdkVersion}</Jdk-Compatibility-Version>
                <Maven-Version>${maven.version}</Maven-Version>
                <Encoding>${project.build.sourceEncoding}</Encoding>
                <Built-By>${project.organization.name}</Built-By>
                <Created-By>${project.organization.name}</Created-By>
                <Created-Date>${date.current}</Created-Date>
                <Vendor>${project.organization.name}</Vendor>
                <Vendor-Url>${project.organization.url}</Vendor-Url>
                <Copyright>Copyright (c) ${date.current.year} ${project.organization.name}</Copyright>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-war-plugin</artifactId>
          <version>2.5</version>
          <configuration>
            <failOnMissingWebXml>false</failOnMissingWebXml>
            <archive>
              <manifest>
                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                <packageName />
              </manifest>
              <manifestEntries>
                <Jdk-Compatibility-Version>${project.build.jdkVersion}</Jdk-Compatibility-Version>
                <Maven-Version>${maven.version}</Maven-Version>
                <Encoding>${project.build.sourceEncoding}</Encoding>
                <Built-By>${project.organization.name}</Built-By>
                <Created-By>${project.organization.name}</Created-By>
                <Created-Date>${date.current}</Created-Date>
                <Vendor>${project.organization.name}</Vendor>
                <Vendor-Url>${project.organization.url}</Vendor-Url>
                <Copyright>Copyright (c) ${date.current.year} ${project.organization.name}</Copyright>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.17</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.17</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <allowTimestampedSnapshots>false</allowTimestampedSnapshots>
            <tagNameFormat>${project.artifactId}-v@{project.version}</tagNameFormat>
            <pomFileName>pom.xml</pomFileName>
            <releaseProfiles>create-release,attach-and-sign</releaseProfiles>
          </configuration>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
          <configuration>
            <retryFailedDeploymentCount>${repo.upload.retryAttempts}</retryFailedDeploymentCount>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.9.1</version>
        </plugin>

        <plugin>
          <groupId>com.soebes.maven.plugins</groupId>
          <artifactId>echo-maven-plugin</artifactId>
          <version>0.2</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>exec-maven-plugin</artifactId>
          <version>1.3.2</version>
        </plugin>

      </plugins>

    </pluginManagement>

    <plugins>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <!-- ### set project.version.lowercase property -->
          <execution>
            <id>set-project.version.lowercase-property</id>
            <goals>
              <goal>regex-property</goal>
            </goals>
            <configuration>
              <name>project.version.lowercase</name>
              <value>${project.version}</value>
              <regex>SNAPSHOT</regex>
              <replacement>snapshot</replacement>
              <failIfNoMatch>false</failIfNoMatch>
            </configuration>
          </execution>
          <!-- ### set parsedVersion property (parsed project.version into components) -->
          <execution>
            <id>set-parsedVersion-property</id>
            <goals>
              <goal>parse-version</goal>
            </goals>
          </execution>
          <!-- ### set maven.version property -->
          <execution>
            <id>set-maven.version-property</id>
            <goals>
              <goal>maven-version</goal>
            </goals>
          </execution>
          <!-- ### set date.current property -->
          <execution>
            <id>set-date.current-property</id>
            <goals>
              <goal>timestamp-property</goal>
            </goals>
            <configuration>
              <name>date.current</name>
              <locale>${project.build.locale}</locale>
              <pattern>yyyy-MM-dd'T'HH:mm:ssZ</pattern>
            </configuration>
          </execution>
          <!-- ### set date.current.year property -->
          <execution>
            <id>set-date.current.year-property</id>
            <goals>
              <goal>timestamp-property</goal>
            </goals>
            <configuration>
              <name>date.current.year</name>
              <locale>${project.build.locale}</locale>
              <pattern>yyyy</pattern>
            </configuration>
          </execution>
          <!-- ### set date.current.humanReadable property -->
          <execution>
            <id>set-date.current.humanReadable-property</id>
            <goals>
              <goal>timestamp-property</goal>
            </goals>
            <configuration>
              <name>date.current.humanReadable</name>
              <locale>${project.build.locale}</locale>
              <pattern>MMMM d, yyyy</pattern>
            </configuration>
          </execution>
          <!-- ### remove old installed artifacts from local repo to free up local disk space -->
          <execution>
            <id>remove-old-installers</id>
            <goals>
              <goal>remove-project-artifact</goal>
            </goals>
            <configuration>
              <removeAll>false</removeAll>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipTests>${test.unit.skipTests}</skipTests>
          <runOrder>${test.runOrder}</runOrder>
          <forkCount>${test.forkCount}</forkCount>
          <reuseForks>${test.reuseForks}</reuseForks>
          <threadCount>${test.threadCount}</threadCount>
          <parallel>${test.parallel}</parallel>
          <argLine>
            -Xmx1024m
            -Xms256m
            -XX:+CMSClassUnloadingEnabled
            -Dlog4j.properties=${log4j.properties}
            -Dfile.encoding=${project.build.sourceEncoding}
            -DskipTests=${test.unit.skipTests}
            -Dmaven.test.skip=${test.unit.skipTests}
            -Dslow=${test.slow}
            -DthreadLocal=${test.threadLocal}
          </argLine>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <skipTests>${test.integration.skipTests}</skipTests>
        </configuration>
        <executions>
          <execution>
            <id>failsafe-integration-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>failsafe-verify</id>
            <phase>verify</phase>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>echo-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>echo</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <echos>
            <echo>Properties:</echo>
            <echo>project.build.jdkVersion=${project.build.jdkVersion}</echo>
            <echo>test.unit.skipTests=${test.unit.skipTests}</echo>
            <echo>test.integration.skipTests=${test.integration.skipTests}</echo>
            <echo>log4j.properties=${log4j.properties}</echo>
            <echo>test.slow=${test.slow}</echo>
            <echo>test.runOrder=${test.runOrder}</echo>
            <echo>test.forkCount=${test.forkCount}</echo>
            <echo>test.threadLocal=${test.threadLocal}</echo>
            <echo>test.threadCount=${test.threadCount}</echo>
            <echo>test.parallel=${test.parallel}</echo>
            <echo>test.reuseForks=${test.reuseForks}</echo>
          </echos>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>nexus-staging-maven-plugin</artifactId>
        <version>1.6.5</version>
        <extensions>true</extensions>
        <configuration>
          <serverId>ossrh</serverId>
          <nexusUrl>https://oss.sonatype.org</nexusUrl>
          <autoReleaseAfterClose>true</autoReleaseAfterClose>
        </configuration>
      </plugin>

    </plugins>

  </build>

  <profiles>

    <profile>
      <id>default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <test.unit.skipTests>false</test.unit.skipTests>
        <test.integration.skipTests>true</test.integration.skipTests>
      </properties>
    </profile>

    <profile>
      <id>attach-and-sign</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <encoding>${project.build.sourceEncoding}</encoding>
                  <docencoding>${project.build.sourceEncoding}</docencoding>
                  <charset>${project.build.sourceEncoding}</charset>
                  <detectOfflineLinks>false</detectOfflineLinks>
                  <detectJavaApiLink>false</detectJavaApiLink>
                  <detectLinks>false</detectLinks>
                  <validateLinks>false</validateLinks>
                  <additionalparam>-Xdoclint:none</additionalparam>
                  <quiet>true</quiet>
                  <keywords>true</keywords>
                </configuration>
              </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>

    <profile>
      <id>create-release</id>
      <properties>
        <test.unit.skipTests>true</test.unit.skipTests>
        <test.integration.skipTests>true</test.integration.skipTests>
      </properties>
    </profile>

  </profiles>

  <pluginRepositories>

    <pluginRepository>
      <id>groupby-public</id>
      <name>GroupBy - Public</name>
      <url>https://artifacts.groupbyinc.com/content/groups/public/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </pluginRepository>

  </pluginRepositories>

  <distributionManagement>

    <repository>
      <id>ossrh</id>
      <name>Sonatype OSS - Releases</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>

    <snapshotRepository>
      <id>ossrh</id>
      <name>Sonatype OSS - Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </snapshotRepository>

  </distributionManagement>

</project>
