<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>

  <!-- We use SonaType for publishing artefacts. Parent POM makes things easier here. -->
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>5</version>
  </parent>

  <!-- Project info. -->
  <groupId>com.carrotsearch</groupId>
  <artifactId>junit-benchmarks</artifactId>
  <version>0.2.1</version>
  <packaging>jar</packaging>

  <name>JUnitBenchmarks</name>
  <description>A framework for writing performance micro-benchmarks using JUnit4 annotations.</description>
  <url>http://labs.carrotsearch.com/junit-benchmarks.html</url>


  <!-- Extended project info. -->
  <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>

  <organization>
    <name>Carrot Search s.c.</name>
    <url>http://www.carrotsearch.com</url>
  </organization>

  <issueManagement>
    <system>Jira</system>
    <url>http://issues.carrot2.org/browse/JUNITBENCH</url>
  </issueManagement>

  <scm>
    <url>https://carrot2.svn.sourceforge.net/svnroot/carrot2/labs/com.carrotsearch.junit-benchmarks/trunk</url>
    <connection>scm:svn:https://carrot2.svn.sourceforge.net/svnroot/carrot2/labs/com.carrotsearch.junit-benchmarks/trunk</connection>
    <developerConnection>scm:svn:https://carrot2.svn.sourceforge.net/svnroot/carrot2/labs/com.carrotsearch.junit-benchmarks/trunk</developerConnection>
  </scm>

  <developers>
    <developer>
      <id>dawid.weiss</id>
      <name>Dawid Weiss</name>
      <email>dawid.weiss@carrotsearch.com</email>
    </developer>

    <developer>
      <id>stanislaw.osinski</id>
      <name>Stanisław Osiński</name>
      <email>stanislaw.osinski@carrotsearch.com</email>
    </developer>
  </developers>

  <!-- Global properties. -->
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
  </properties>


  <!-- Dependencies. -->
  <dependencies>
    <!-- Optional at runtime. -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.2.127</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

    <!-- Required for tests only. -->
    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>1.6.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <!-- Build tuning. -->
  <build>
    <defaultGoal>install</defaultGoal>

    <!-- Confugure maven release plugin to make use of the profiles. -->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.1</version>
        <configuration>
          <useReleaseProfile>true</useReleaseProfile>
          <releaseProfiles>release,maven-release</releaseProfiles>
        </configuration>
      </plugin>
    </plugins>

    <!-- Exclude these resources when packaging. -->
    <resources>
      <resource>
        <directory>${project.basedir}/src/main/resources</directory>
        <excludes>
          <exclude>**/*.json</exclude>
        </excludes>
      </resource>
    </resources>
  </build>

  <profiles>
    <!-- No tests, no additional checks. -->
    <profile>
      <id>fastinstall</id>
      <properties>
        <maven.test.skip>true</maven.test.skip>
      </properties>
      <build>
        <defaultGoal>install</defaultGoal>
      </build>
    </profile>

    <!-- Release mode. -->
    <profile>
      <id>release</id>

      <build>
        <defaultGoal>install</defaultGoal>

        <plugins>
          <!-- Attach and modify JavaDocs. -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.6.1</version>
            <configuration>
              <encoding>${project.build.sourceEncoding}</encoding>
              <stylesheetfile>${basedir}/src/main/javadoc/stylesheet.css</stylesheetfile>
              <docfilessubdirs>true</docfilessubdirs>
              <windowtitle>JUnitBenchmarks v${version} API Documentation
                (JavaDoc)</windowtitle>
              <doctitle>JUnitBenchmarks v${version} API Documentation</doctitle>
              <header><![CDATA[<div id='header'><a class='logo' target='_top' href='http://labs.carrotsearch.com'><img src='resources/logo.png'></a>JUnitBenchmarks v${version} <br>API Documentation</div>]]></header>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Attach sources -->
          <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</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Configure assembly of ZIP and TAR.GZ bundles (stand-alone distributions). -->
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/bin.xml</descriptor>
              </descriptors>
              <attach>false</attach>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>package</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Manual maven release mode. Prepare bundle ZIPs, sign everything once completed 
      and prepare sonatype's release bundle. -->
    <profile>
      <id>maven-release</id>
      <build>
        <defaultGoal>verify</defaultGoal>

        <plugins>
          <!-- GPG sign artefacts. -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.1</version>
            <configuration>
              <excludes>
                <exclude>**/*.gz</exclude>
                <exclude>**/*.zip</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Create a release bundle for SonaType. -->
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2</version>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/release.xml</descriptor>
              </descriptors>
              <finalName>release-bundle</finalName>
              <attach>false</attach>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
            <executions>
              <execution>
                <id>make-assembly</id>
                <phase>verify</phase>
                <goals>
                  <goal>single</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
