<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>

  <!-- Project info. -->
  <groupId>org.scijava</groupId>
  <artifactId>junit-benchmarks</artifactId>
  <version>0.7.3-scijava</version>
  <packaging>jar</packaging>

  <name>JUnitBenchmarks</name>
  <description>A framework for writing performance micro-benchmarks using JUnit4 annotations, forked from https://github.com/carrotsearch/junit-benchmarks.</description>
  <url>https://github.com/scijava/junit-benchmarks</url>

  <prerequisites>
    <maven>3.0.2</maven>
  </prerequisites>

  <!-- 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>SciJava</name>
    <url>http://scijava.github.io/</url>
  </organization>

  <issueManagement>
    <system>GitHub</system>
    <url>https://github.com/scijava/junit-benchmarks/issues</url>
  </issueManagement>

  <mailingLists>
    <mailingList>
      <name>SciJava</name>
      <subscribe>https://groups.google.com/group/scijava</subscribe>
      <unsubscribe>https://groups.google.com/group/scijava</unsubscribe>
      <post>scijava@googlegroups.com</post>
      <archive>https://groups.google.com/group/scijava</archive>
    </mailingList>
  </mailingLists>

  <scm>
    <tag>junit-benchmarks-0.7.3-scijava</tag>
    <url>https://github.com/scijava/junit-benchmarks.git</url>
    <connection>scm:git:git://github.com/scijava/junit-benchmarks.git</connection>
    <developerConnection>scm:git:git@github.com:scijava/junit-benchmarks.git</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>

    <clover.version>3.1.0</clover.version>
    <gpg.passphrase />
  </properties>

  <!-- Dependencies. -->
  <dependencies>
    <!-- Optional at runtime. -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.3.160</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.22</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.4</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-core-asl</artifactId>
      <version>1.9.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
      <version>1.9.2</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-mxj</artifactId>
      <version>5.0.12</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <!--
            This is a 133 MB dependency.  We should only require it
            when running the test profile for mysql.
          -->
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-mxj-db-files</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.easytesting</groupId>
      <artifactId>fest-assert-core</artifactId>
      <version>2.0M10</version>
      <scope>test</scope>
    </dependency>
  </dependencies>


  <!-- Build tuning. -->
  <build>
    <defaultGoal>install</defaultGoal>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.3.2</version>
        </plugin>

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

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

        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.4</version>
        </plugin>

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

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-site-plugin</artifactId>
        <version>3.2</version>
        <configuration>
          <reportPlugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
              <version>2.6</version>
              <configuration>
                <dependencyDetailsEnabled>false</dependencyDetailsEnabled>
                <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
              </configuration>
              <reports>
                <report>dependencies</report>
                <report>scm</report>
              </reports>
            </plugin>

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-jxr-plugin</artifactId>
              <version>2.3</version>
              <reportSets>
                <reportSet>
                  <id>src-xref</id>
                  <reports>
                    <report>jxr</report>
                  </reports>
                </reportSet>
              </reportSets>
            </plugin>

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-pmd-plugin</artifactId>
              <version>2.7.1</version>
              <reportSets>
                <reportSet>
                  <id>cpd</id>
                  <reports>
                    <report>cpd</report>
                  </reports>
                </reportSet>
              </reportSets>
              <configuration>
                <targetJdk>${maven.compiler.target}</targetJdk>
                <aggregate>true</aggregate>
              </configuration>
            </plugin>

            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-report-plugin</artifactId>
              <version>2.12.4</version>
              <reportSets>
                <reportSet>
                  <id>main</id>
                  <reports>
                    <report>report-only</report>
                  </reports>
                </reportSet>
              </reportSets>
              <configuration>
                <linkXRef>false</linkXRef>
              </configuration>
            </plugin>

            <plugin>
              <groupId>org.codehaus.mojo</groupId>
              <artifactId>findbugs-maven-plugin</artifactId>
              <version>2.5.2</version>
              <configuration>
                <findbugsXmlOutput>true</findbugsXmlOutput>
                <excludeFilterFile>${basedir}/src/findbugs/exclude-filters.xml</excludeFilterFile>
                <includeTests>false</includeTests>
              </configuration>
            </plugin>

            <plugin>
              <groupId>com.atlassian.maven.plugins</groupId>
              <artifactId>maven-clover2-plugin</artifactId>
              <version>${clover.version}</version>
              <configuration>
                <generateXml>true</generateXml>
                <generateHtml>true</generateHtml>
              </configuration>
            </plugin>
          </reportPlugins>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <useReleaseProfile>true</useReleaseProfile>
          <releaseProfiles>release,maven-release</releaseProfiles>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.7</version>
        <executions>
          <execution>
            <id>antrun-retrotranslate-jdk15</id>
            <phase>package</phase>
            <configuration>
              <target>
                <taskdef name="retrotranslator" classname="net.sf.retrotranslator.transformer.RetrotranslatorTask" classpathref="maven.plugin.classpath" />

                <retrotranslator verbose="true" verify="false" failonwarning="true" target="1.5" embed="com.carrotsearch.junitbenchmarks.backport" destjar="${project.build.directory}/${project.build.finalName}-jdk15.jar">

                  <jarfileset dir="${project.build.directory}" includes="${project.build.finalName}.jar" />

                  <classpath>
                    <pathelement location="${basedir}/src/main/retrotranslator" />
                  </classpath>
                  <classpath refid="maven.plugin.classpath" />
                  <classpath refid="maven.compile.classpath" />
                  <classpath>
                    <fileset dir="${java.home}/lib" includes="rt.jar" />
                  </classpath>
                </retrotranslator>

                <attachartifact file="${project.build.directory}/${project.build.finalName}-jdk15.jar" classifier="jdk15" type="jar" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>net.sf.retrotranslator</groupId>
            <artifactId>retrotranslator-transformer</artifactId>
            <version>1.2.9</version>
          </dependency>
          <dependency>
            <groupId>net.sf.retrotranslator</groupId>
            <artifactId>retrotranslator-runtime</artifactId>
            <version>1.2.9</version>
          </dependency>
          <dependency>
            <groupId>backport-util-concurrent</groupId>
            <artifactId>backport-util-concurrent</artifactId>
            <version>3.1</version>
          </dependency>
        </dependencies>
      </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>

    <!-- Execute clover code coverage reports via ANT. -->
    <profile>
      <id>clover</id>

      <build>
        <plugins>
          <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-clover2-plugin</artifactId>
            <version>${clover.version}</version>
            <configuration>
              <includesTestSourceRoots>false</includesTestSourceRoots>
            </configuration>
            <executions>
              <execution>
                <phase>pre-site</phase>
                <goals>
                  <goal>instrument-test</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Release mode. -->
    <profile>
      <id>sonatype-oss-release</id>
      <build>
        <defaultGoal>install</defaultGoal>
        <plugins>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.5.1</version>
            <extensions>true</extensions>
            <inherited>false</inherited>
            <configuration>
              <serverId>sonatype-nexus-releases</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <!-- By having no explicit stagingProfileId, we use Staging V2 in "auto" mode, profile will be matched server side -->
              <!--stagingProfileId></stagingProfileId-->
            </configuration>
          </plugin>
          <plugin>
            <inherited>true</inherited>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <version>2.7</version>
            <configuration>
              <updateReleaseInfo>true</updateReleaseInfo>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>1.4</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.2.1</version>
            <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>
            <version>2.9.1</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Special build profile for testing against embedded mysql -->
    <profile>
      <id>tests-include-mysql</id>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-mxj-db-files</artifactId>
          <version>5.0.12</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.13</version>
            <configuration>
              <includes>
                <include>**/MySQLConsumerT.java</include>
                <include>**/Test*.java</include>
                <include>**/*Test.java</include>
                <include>**/*TestCase.java</include>
              </includes>
            </configuration>
          </plugin>
          <plugin>
            <!-- Find free ports to run the mysql instance -->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
              <execution>
                <id>reserve-server-port</id>
                <goals>
                  <goal>reserve-network-port</goal>
                </goals>
                <phase>process-resources</phase>
                <configuration>
                  <portNames>
                    <portName>mysql.port</portName>
                  </portNames>
                  <outputFile>target/mysql.properties</outputFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
