<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>nl.basjes.hadoop</groupId>
  <artifactId>splittablegzip</artifactId>
  <version>1.2</version>
  <packaging>jar</packaging>
  <name>Splittable Gzip codec</name>

  <description>A Hadoop specific enhancement of GZip that allows running a single gzipped file on multiple mappers.</description>
  <url>https://github.com/nielsbasjes/splittablegzip</url>

  <properties>
    <jdkLevel>1.7</jdkLevel>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.build.outputEncoding>UTF-8</project.build.outputEncoding>
    <hadoop.version>2.3.0</hadoop.version>
  </properties>
  
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-client</artifactId>
      <version>${hadoop.version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.7</version>
    </dependency>

  </dependencies>

  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>2.1.2</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

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

          <plugin>
            <!-- explicitly define maven-deploy-plugin after other to force exec order -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.8.1</version>
            <executions>
              <execution>
                <id>deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>deploy</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>
    
    <profile>
      <id>rpm</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>rpm-maven-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
              <license>Apache License v2.0</license>
              <packager>Niels Basjes</packager>
              <group>Development/Libraries</group>
              <needarch>noarch</needarch>
              <version>${project.version}</version>
              <description>
This codec offers a trade off between "spent resources" and "scalability"
when reading Gzipped input files by simply always starting at the beginning
of the file. So in general this "splittable" Gzip codec will WASTE CPU time and
FileSystem IO (HDFS) and probably other system resources (Network)
too to reduce the "wall clock" time in some real-life situations.
              </description>
              <release>1</release>
              <mappings>
                <mapping>
                  <directory>/usr/lib/hadoop</directory>
                  <username>root</username>
                  <groupname>root</groupname>
                  <sources>
                    <source>
                      <location>target/${project.build.finalName}.jar</location>
                    </source>
                  </sources>
                </mapping>

                <mapping>
                  <directory>/usr/share/doc/${project.build.finalName}/apidocs</directory>
                  <username>root</username>
                  <groupname>root</groupname>
                  <sources>
                    <source>
                      <location>target/apidocs</location>
                    </source>
                  </sources>
                </mapping>

                <mapping>
                  <directory>/usr/share/doc/${project.build.finalName}/</directory>
                  <username>root</username>
                  <groupname>root</groupname>
                  <sources>
                    <source>
                      <location>src/main/resources/mapred-site.xml.example</location>
                    </source>
                  </sources>
                </mapping>
              </mappings>

              <keyname>${gpg.keyname}</keyname>
              <keyPassphrase><passphrase>${gpg.passphrase}</passphrase></keyPassphrase>

            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>attached-rpm</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
    </profile>
  </profiles>

  <build>
    <plugins>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.0</version>
        <configuration>
          <source>${jdkLevel}</source>
          <target>${jdkLevel}</target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>2.7.1</version>
        <configuration>
          <linkXRef>true</linkXRef>
          <!-- <rulesets> <ruleset> /pmd-ruleset.xml </ruleset> </rulesets> -->
        </configuration>
          <executions>
              <execution>
                  <phase>package</phase>
                  <goals>
                      <goal>cpd-check</goal> <!-- Fail the build if copy/paste detector fails -->
                  </goals>
                  <configuration>
                      <verbose>true</verbose>
                  </configuration>
              </execution>
          </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>findbugs-maven-plugin</artifactId>
        <version>2.0.1</version>
        <configuration>
          <!--<targetJdk>${targetJdk}</targetJdk>-->
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Niels Basjes</name>
      <email>niels@basjes.nl</email>
      <roles>
        <role>Architect</role>
        <role>Developer</role>
      </roles>
      <timezone>Europe/Amsterdam</timezone>
    </developer>
  </developers>

  <scm>
    <developerConnection>scm:git:.</developerConnection>
    <connection>https://github.com/nielsbasjes/splittablegzip.git</connection>
    <url>https://github.com/nielsbasjes/splittablegzip</url>
  </scm>

</project>
