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

  <parent>
    <groupId>net.sf.ehcache</groupId>
    <artifactId>ehcache-terracotta-root</artifactId>
    <version>2.4.2</version>
  </parent>

  <artifactId>ehcache-terracotta</artifactId>
  <name>ehcache-terracotta</name>
  <packaging>jar</packaging>
  <description>Terracotta clustering support for Ehcache</description>

  <dependencies>
    <!-- bootstrap code -->
    <dependency>
      <groupId>net.sf.ehcache</groupId>
      <artifactId>ehcache-terracotta-bootstrap</artifactId>
      <version>2.4.2</version>
      <optional>true</optional>
    </dependency>

    <!-- TIMs that we bundle in this express package -->
    <dependency>
      <groupId>org.terracotta.modules</groupId>
      <artifactId>tim-ehcache-2.x</artifactId>
      <version>${tim-ehcache-2.x.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.terracotta.modules</groupId>
      <artifactId>tim-ehcache-2.x-ui</artifactId>
      <version>${tim-ehcache-2.x.version}</version>
      <optional>true</optional>
      <exclusions>
        <exclusion>
          <groupId>org.terracotta</groupId>
          <artifactId>terracotta</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
        <executions>
          <execution>
            <id>copy-dep</id>
            <phase>package</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.terracotta.modules</groupId>
                  <artifactId>tim-ehcache-2.x</artifactId>
                  <version>${tim-ehcache-2.x.version}</version>
                  <type>jar</type>
                  <overWrite>true</overWrite>
                  <outputDirectory>${project.build.directory}</outputDirectory>
                  <destFileName>tim-ehcache-2.x.jar</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>1.3</version>
        <configuration>
          <tasks>
            <unzip src="${project.build.directory}/tim-ehcache-2.x.jar"
              dest="${project.build.directory}/classes">
              <patternset>
                <includesfile
                  name="src/main/resources/META-INF/terracotta/public-api-types" />
              </patternset>
            </unzip>
          </tasks>
        </configuration>
        <executions>
          <execution>
            <id>unjar-classes</id>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.terracotta</groupId>
        <artifactId>maven-forge-plugin</artifactId>
        <version>1.0.0</version>
        <configuration>
          <manifestFile>${project.build.directory}/MANIFEST.MF</manifestFile>
          <manifestEntries>
            <Terracotta-ProjectStatus>Supported</Terracotta-ProjectStatus>
            <Terracotta-Name>${project.artifactId}</Terracotta-Name>
            <Terracotta-Description>${project.description}</Terracotta-Description>
          </manifestEntries>
        </configuration>
        <executions>
          <execution>
            <id>create-manifest</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2-beta-5</version>
        <configuration>
          <finalName>${project.artifactId}-${project.version}</finalName>
          <appendAssemblyId>false</appendAssemblyId>
          <attach>true</attach>
          <descriptors>
            <descriptor>${basedir}/src/main/assembly/bin.xml</descriptor>
          </descriptors>
          <archive>
            <manifestFile>${project.build.directory}/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  
  <repositories>
    <repository>
      <id>terracotta-releases</id>
      <url>http://www.terracotta.org/download/reflector/releases</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>terracotta-releases</id>
      <url>http://www.terracotta.org/download/reflector/releases</url>
    </pluginRepository>
  </pluginRepositories>

</project>
