<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>
  <prerequisites>
    <maven>3.0.0</maven>
  </prerequisites>

  <groupId>joinery</groupId>
  <artifactId>joinery-dataframe</artifactId>
  <version>1.7</version>
  <packaging>jar</packaging>

  <name>Joinery</name>
  <description>Data frames for Java</description>
  <url>http://cardillo.github.io/joinery</url>

  <licenses>
    <license>
      <name>GNU General Public License</name>
      <url>https://www.gnu.org/licenses/gpl-3.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Bryan Cardillo</name>
      <email>bryan.cardillo@gmail.com</email>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git@github.com:cardillo/joinery.git</connection>
    <developerConnection>scm:git:git@github.com:cardillo/joinery.git</developerConnection>
    <url>git@github.com:cardillo/joinery.git</url>
    <tag>v1.7</tag>
  </scm>

  <properties>
    <project.build.sourceEncoding>iso-8859-1</project.build.sourceEncoding>
    <project.reporting.outputEncoding>iso-8859-1</project.reporting.outputEncoding>
    <java.version>1.7</java.version>
    <junit.version>4.12</junit.version>
    <supercsv.version>2.3.1</supercsv.version>
    <commons-math3.version>3.4.1</commons-math3.version>
    <poi.version>3.11</poi.version>
    <aspectj.version>1.8.2</aspectj.version>
    <metrics.version>3.1.1</metrics.version>
    <xchart.version>2.4.3</xchart.version>
    <jline.version>2.12.1</jline.version>
    <slf4j.version>1.7.7</slf4j.version>

    <!-- use property to allow redefining via profiles/command line -->
    <groups>!joinery.perf.PerformanceTests</groups>
    <parallel>all</parallel>
  </properties>

  <dependencies>
    <!-- build deps -->
    <dependency>
      <groupId>io.dropwizard.metrics</groupId>
      <artifactId>metrics-annotation</artifactId>
      <version>${metrics.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>net.sf.supercsv</groupId>
      <artifactId>super-csv</artifactId>
      <version>${supercsv.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-math3</artifactId>
      <version>${commons-math3.version}</version>
    </dependency>

    <!-- optional deps for additional functionality -->
    <dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi</artifactId>
      <version>${poi.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.xeiam.xchart</groupId>
      <artifactId>xchart</artifactId>
      <version>${xchart.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>de.erichseifert.vectorgraphics2d</groupId>
          <artifactId>VectorGraphics2D</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>rhino</groupId>
      <artifactId>js</artifactId>
      <version>1.7R2</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>jline</groupId>
      <artifactId>jline</artifactId>
      <version>${jline.version}</version>
      <optional>true</optional>
    </dependency>

    <!-- test deps -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <!-- configure compile phase -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.2</version>
          <configuration>
            <source>${java.version}</source>
            <target>${java.version}</target>
            <excludes>
              <!-- exclude metrics by default -->
              <exclude>**/Metrics.java</exclude>
            </excludes>
          </configuration>
        </plugin>

        <!-- configure test phase -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.18.1</version>
          <configuration>
            <!-- parallel tests -->
            <parallel>${parallel}</parallel>
            <threadCount>8</threadCount>
            <groups>${groups}</groups>
          </configuration>
        </plugin>

        <!-- configure integration/verify phase -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <version>2.18.1</version>
          <configuration>
            <!-- parallel tests -->
            <parallel>all</parallel>
            <threadCount>2</threadCount>
            <!-- run performance tests as part of integration/verify -->
            <includes>
              <include>**/*PerfTest.java</include>
            </includes>
            <groups>joinery.perf.PerformanceTests</groups>
          </configuration>
        </plugin>

        <!-- configure release plugin -->
        <plugin>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.1</version>
          <configuration>
            <releaseProfiles>release</releaseProfiles>
            <tagNameFormat>v@{project.version}</tagNameFormat>
          </configuration>
        </plugin>

        <!-- configure javadoc generation -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.10.1</version>
          <configuration>
            <docletArtifact>
              <groupId>com.google.doclava</groupId>
              <artifactId>doclava</artifactId>
              <version>1.0.5</version>
            </docletArtifact>
            <doclet>com.google.doclava.Doclava</doclet>
            <additionalparam>
              -quiet
              -hdf project.name "${project.name}"
              -d ${project.build.directory}/apidocs
              -templatedir ${basedir}/src/main/resources/templates
            </additionalparam>
            <useStandardDocletOptions>false</useStandardDocletOptions>
            <excludePackageNames>joinery.impl</excludePackageNames>
          </configuration>
        </plugin>

        <!-- configure build number -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>buildnumber-maven-plugin</artifactId>
          <version>1.3</version>
          <configuration>
            <shortRevisionLength>7</shortRevisionLength>
          </configuration>
        </plugin>

        <!-- configure jar manifest -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.5</version>
          <configuration>
            <archive>
              <manifestEntries>
                <Name>${project.groupId}/</Name>
                <Specification-Title>${project.description}</Specification-Title>
                <Specification-Version>${project.version}</Specification-Version>
                <Implementation-Version>${buildNumber}</Implementation-Version>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <!-- configure executable jar creation -->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <descriptorRefs>
              <descriptorRef>jar-with-dependencies</descriptorRef>
            </descriptorRefs>
            <archive>
              <manifest>
                <mainClass>joinery.DataFrame</mainClass>
              </manifest>
              <manifestEntries>
                <Name>${project.groupId}/</Name>
                <Specification-Title>${project.name}</Specification-Title>
                <Specification-Version>${project.version}</Specification-Version>
                <Implementation-Title>${project.description}</Implementation-Title>
                <Implementation-Version>${buildNumber}</Implementation-Version>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.6</version>
        </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-clean-plugin</artifactId>
          <version>2.6.1</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </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-resources-plugin</artifactId>
          <version>2.7</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.4</version>
        </plugin>

        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>aspectj-maven-plugin</artifactId>
          <version>1.7</version>
          <configuration>
            <target>${java.version}</target>
            <complianceLevel>${java.version}</complianceLevel>
            <verbose>true</verbose>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <!-- exclude performance tests (they take a while) -->
          <groups>${groups}</groups>
        </configuration>
      </plugin>

      <!-- run integration tests as part of verify goal -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- create executable jar with dependencies -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>assemble-all</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <distributionManagement>
    <repository>
      <id>bintray</id>
      <url>https://api.bintray.com/maven/cardillo/maven/joinery</url>
    </repository>
  </distributionManagement>

  <profiles>
    <!-- optional bits for building with metrics enabled -->
    <profile>
      <id>build-metrics</id>
      <activation>
        <property>
          <name>build</name>
          <value>metrics</value>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>io.dropwizard.metrics</groupId>
          <artifactId>metrics-core</artifactId>
          <version>${metrics.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.aspectj</groupId>
          <artifactId>aspectjrt</artifactId>
          <version>${aspectj.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-nop</artifactId>
          <version>${slf4j.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
              <includes>
                <include>**/*.java</include>
              </includes>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>compile</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- for building doctest suite -->
    <profile>
      <id>build-doctest</id>
      <activation>
        <jdk>[1.6,)</jdk>
      </activation>
      <dependencies>
        <dependency>
          <groupId>com.sun</groupId>
          <artifactId>tools</artifactId>
          <version>${java.version}</version>
          <scope>system</scope>
          <systemPath>${java.home}/../lib/tools.jar</systemPath>
          <optional>true</optional>
        </dependency>
      </dependencies>
    </profile>

    <!-- profile for release builds -->
    <profile>
      <id>release</id>
      <properties>
        <groups />
      </properties>
      <build>
        <plugins>
          <!-- configure source generation -->
          <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>

          <!-- create javadoc archive -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- configure signing -->
          <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 to prevent test groups from filtering out
         tests which are explicitly requested via -Dtest="..." -->
    <profile>
      <id>all-tests</id>
      <activation>
        <property>
          <name>test</name>
        </property>
      </activation>
      <properties>
        <groups />
        <parallel>none</parallel>
      </properties>
    </profile>
  </profiles>
</project>
