<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2012 CoreMedia AG
  ~
  ~ This file is part of Joala.
  ~
  ~ Joala is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ Joala is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with Joala.  If not, see <http://www.gnu.org/licenses />.
  -->
<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>net.joala</groupId>
    <artifactId>joala-parent</artifactId>
    <version>1.2.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>joala-matchers</artifactId>
  <name>Joala Matchers</name>

  <description>Matchers in addition to those provided by Hamcrest. Might be added as proposal to
    Hamcrest matchers. Thus take these as experimental.
  </description>

  <properties>
    <hamcrest.generated.sources>${generated.sources.root}/hamcrest</hamcrest.generated.sources>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-library</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>create-generated-sources-dir</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <target>
                <mkdir dir="${hamcrest.generated.sources}" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <!-- see http://code.google.com/p/hamcrest/wiki/Tutorial#Sugar_generation -->
            <id>generate-hamcrest-JoalaMatchers</id>
            <goals>
              <goal>java</goal>
            </goals>
            <phase>process-classes</phase>
            <configuration>
              <includeProjectDependencies>true</includeProjectDependencies>
              <includePluginDependencies>true</includePluginDependencies>
              <mainClass>org.hamcrest.generator.config.XmlConfigurator</mainClass>
              <arguments>
                <!-- config-file -->
                <argument>${project.basedir}/src/main/build/JoalaMatchers.xml</argument>
                <!-- source-dir -->
                <argument>${project.build.sourceDirectory}</argument>
                <!-- generated-class -->
                <argument>net.joala.matcher.JoalaMatchers</argument>
                <!-- output-dir -->
                <argument>${hamcrest.generated.sources}</argument>
              </arguments>
              <sourceRoot>${hamcrest.generated.sources}</sourceRoot>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-generator</artifactId>
            <version>1.3</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>compile-hamcrest-matchers</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>process-classes</phase>
            <configuration>
              <generatedSourcesDirectory>${hamcrest.generated.sources}</generatedSourcesDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
