<?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>6</version>
    <relativePath />
  </parent>

  <artifactId>api-java-flux</artifactId>
  <version>2.2.51</version>

  <packaging>jar</packaging>

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

  <scm>
    <url>https://github.com/groupby/api-java</url>
    <connection>scm:git:git@github.com:groupby/api-java.git</connection>
    <developerConnection>scm:git:git@github.com:groupby/api-java.git</developerConnection>
    <tag>v2.2.51</tag>
  </scm>

  <properties>

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

    <!-- ### Versions -->
    <groupbyinc.common.version>43</groupbyinc.common.version>
    <api.servlet.version>2.5</api.servlet.version>
    <api.jsp.version>2.1</api.jsp.version>
    <junit.version>4.12</junit.version>
    <cloning.util.version>1.9.2</cloning.util.version>
    <jregex.version>1.2_01</jregex.version>

    <!-- ### Test -->
    <test.runOrder>random</test.runOrder>
    <test.forkCount>1C</test.forkCount>
    <test.reuseForks>true</test.reuseForks>
    <test.slow>false</test.slow>
    <test.threadLocal>true</test.threadLocal>
    <test.threadCount>4</test.threadCount>
    <test.parallel>classesAndMethods</test.parallel>
    <test.unit.skipTests>true</test.unit.skipTests>

  </properties>

  <dependencies>

    <!-- ### GroupBy -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>common-jackson</artifactId>
      <version>${groupbyinc.common.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>common-http</artifactId>
      <version>${groupbyinc.common.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>common-util</artifactId>
      <version>${groupbyinc.common.version}</version>
      <optional>true</optional>
    </dependency>

    <!-- ### Servlet/JSP/JSTL -->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>${api.servlet.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>${api.jsp.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- ### Test -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>common-test</artifactId>
      <version>${groupbyinc.common.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <defaultGoal>clean install</defaultGoal>

    <pluginManagement>

      <plugins>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.3</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.3</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>3.0.0</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.10</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.4.2</version>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.6</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.6</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.19</version>
        </plugin>

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

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <autoVersionSubmodules>true</autoVersionSubmodules>
            <allowTimestampedSnapshots>false</allowTimestampedSnapshots>
            <tagNameFormat>v@{project.version}</tagNameFormat>
            <pomFileName>pom.xml</pomFileName>
            <goals>deploy</goals>
            <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.4.0</version>
        </plugin>

        <plugin>
          <groupId>de.jutzig</groupId>
          <artifactId>github-release-plugin</artifactId>
          <version>1.1.1</version>
          <configuration>
            <description>Release v${project.version}</description>
            <releaseName>v${project.version}</releaseName>
            <tag>v${project.version}</tag>
          </configuration>
        </plugin>

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

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadeTestJar>true</shadeTestJar>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <shadedClassifierName>uber</shadedClassifierName>
              <createSourcesJar>true</createSourcesJar>
              <createDependencyReducedPom>true</createDependencyReducedPom>
              <dependencyReducedPomLocation>${project.build.directory}/${project.build.finalName}.pom</dependencyReducedPomLocation>
              <artifactSet>
                <includes>
                  <include>${project.groupId}:*</include>
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <!-- excludes for preventing OSGi bundles from complaining -->
                  <excludes>
                    <exclude>com/groupbyinc/common/apache/commons/logging/impl/Avalon*</exclude>
                    <exclude>com/groupbyinc/common/apache/commons/logging/impl/LogKit*</exclude>
                    <exclude>com/groupbyinc/common/apache/commons/logging/impl/Log4J*</exclude>
                  </excludes>
                </filter>
                <filter>
                  <artifact>${project.groupId}:${project.parent.artifactId}-common</artifact>
                  <includes>
                    <include>com/groupbyinc/**</include>
                    <include>META-INF/commerce.tld</include>
                  </includes>
                </filter>
              </filters>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Archive-Type>Uber JAR</Archive-Type>
                  </manifestEntries>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <finalName>api-java-flux-${project.version}</finalName>
          <descriptors>
            <descriptor>${project.basedir}/bin.xml</descriptor>
          </descriptors>
        </configuration>
        <executions>
          <execution>
            <id>create-compressed-packages</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

  <profiles>

    <profile>
      <id>create-release</id>
      <properties>
        <test.unit.skipTests>true</test.unit.skipTests>
        <test.integration.skipTests>true</test.integration.skipTests>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>de.jutzig</groupId>
            <artifactId>github-release-plugin</artifactId>
            <executions>
              <execution>
                <id>github-deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>release</goal>
                </goals>
                <configuration>
                  <artifact>${project.build.directory}/${project.artifactId}-${project.version}-uber.jar</artifact>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>unit</id>
      <properties>
        <test.unit.skipTests>false</test.unit.skipTests>
      </properties>
    </profile>

    <!-- ### Needed for build integration -->
    <profile>
      <id>slow</id>
      <properties>
        <test.unit.skipTests>false</test.unit.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>

  </profiles>

  <repositories>

    <repository>
      <id>sonatype-releases</id>
      <name>Sonatype - Releases</name>
      <url>https://oss.sonatype.org/content/repositories/releases/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>

  </repositories>

  <pluginRepositories>

    <pluginRepository>
      <id>sonatype-releases</id>
      <name>Sonatype - Releases</name>
      <url>https://oss.sonatype.org/content/repositories/releases/</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</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>
