<?xml version='1.0' encoding='UTF-8'?>
<!--

   All content copyright (c) 2003-2008 Terracotta, Inc.,
   except as may otherwise be noted in a separate copyright notice.
   All rights reserved.

-->
<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>org.terracotta.forge</groupId>
    <artifactId>forge-parent</artifactId>
    <version>2.2</version>
  </parent>

  <groupId>org.terracotta.maven.plugins</groupId>
  <artifactId>tc-maven-plugin</artifactId>
  <version>1.6.2</version>
  <packaging>maven-plugin</packaging>

  <name>Terracotta Maven Plugin</name>
  <description>Maven Plugin for Terracotta</description>

  <licenses>
    <license>
      <name>Terracotta Public License</name>
      <url>http://www.terracotta.org/license.txt</url>
    </license>
  </licenses>

  <properties>
    <terracotta.core.version>3.5.0</terracotta.core.version>
    <tim-api.version>1.3.0</tim-api.version>
    <forgeTags>Plugin</forgeTags>
    <stagingLocalRepository>${settings.localRepository}</stagingLocalRepository>
  </properties>
  
  <scm>
    <connection>scm:svn:http://svn.terracotta.org/svn/forge/projects/tc-maven-plugin/trunk</connection>
    <developerConnection>scm:svn:https://svn.terracotta.org/repo/forge/projects/tc-maven-plugin/trunk</developerConnection>
    <url>http://svn.terracotta.org/svn/forge/projects/tc-maven-plugin/trunk</url>
  </scm>

  <!--  -->
  <repositories>
    <repository>
      <id>terracotta-repository</id>
      <url>http://www.terracotta.org/download/reflector/releases</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>

    <repository>
      <releases />
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>codehaus-repository</id>
      <url>http://repository.codehaus.org/</url>
    </repository>
    <repository>
      <id>java.net</id>
      <url>http://download.java.net/maven/1</url>
      <layout>legacy</layout>
    </repository>
    <repository>
      <releases />
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <id>tomcat-repository</id>
      <url>http://tomcat.apache.org/dev/dist/m2-repository/</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>codehaus-repository</id>
      <name>Codehaus Repository</name>
      <url>http://repository.codehaus.org/</url>
    </pluginRepository>
    <pluginRepository>
      <id>codehaus-repository-snapshot</id>
      <name>Codehaus Snapshot Repository</name>
      <url>http://snapshots.repository.codehaus.org/</url>
      <releases>
        <enabled>false</enabled>
      </releases>
      <snapshots />
    </pluginRepository>
    <pluginRepository>
      <releases>
        <enabled>false</enabled>
      </releases>
      <id>apache.snapshots</id>
      <name>Apache Snapshot Repository</name>
      <url>http://people.apache.org/repo/m2-snapshot-repository</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.2</version>
    </dependency>
    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.0.4</version>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <version>3.1</version>
    </dependency>

    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
      <version>2.0.7</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>2.0.7</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-project</artifactId>
      <version>2.0.7</version>
    </dependency>
    <dependency>
    	<groupId>org.apache.maven.plugins</groupId>
    	<artifactId>maven-help-plugin</artifactId>
    	<version>2.1</version>
    </dependency> 
    
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>1.0.69</version>
    </dependency>

    <!-- surefire -->
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-booter</artifactId>
      <version>2.4.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-api</artifactId>
      <version>2.4.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-junit</artifactId>
      <version>2.4.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-junit4</artifactId>
      <version>2.4.3</version>
    </dependency>

    <!-- Terracotta -->
    <dependency>
      <groupId>org.terracotta.api</groupId>
      <artifactId>tim-api</artifactId>
      <version>${tim-api.version}</version>
    </dependency>
    <dependency>
      <groupId>org.terracotta</groupId>
      <artifactId>terracotta</artifactId>
      <version>${terracotta.core.version}</version>
    </dependency>
    <dependency>
      <groupId>org.terracotta</groupId>
      <artifactId>tcconfig</artifactId>
      <version>${terracotta.core.version}</version>
    </dependency>

    <!-- Cargo support -->
    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-maven2-plugin</artifactId>
      <version>1.0-alpha-5</version>
    </dependency>
    
    <!-- Testing -->
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-plugin-testing-harness</artifactId>
      <version>1.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
<!--
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.2-beta-5</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>src</descriptorRef>
            <descriptorRef>bin</descriptorRef>
          </descriptorRefs>
          <outputDirectory>${project.build.directory}/site/downloads</outputDirectory>
        </configuration>
        <executions>
          <execution>
            <phase>site</phase>
            <goals>
              <goal>assembly</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
-->
    </plugins>
  </build>
  
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-plugin-plugin</artifactId>
        <version>2.6</version>
      </plugin>
    </plugins>
  </reporting>
  
  <profiles>
    <profile>
      <id>integration-tests-stage</id>
      <activation>
        <property>
          <name>integration-tests-stage</name>
          <value>true</value>
        </property>
      </activation>

      <properties>
        <stagingLocalRepository>${project.build.directory}/local-repository</stagingLocalRepository>
      </properties>
      
      <build>
        <plugins>
          <!-- stage plugin for integration test -->
          <plugin>
            <artifactId>maven-component-it-plugin</artifactId>
            <version>1.0</version>

            <configuration>
              <pluginVersion>testing</pluginVersion>
              <!-- <repositoryDirectory>${project.build.directory}/local-repository</repositoryDirectory> -->
              <repositoryDirectory>${stagingLocalRepository}</repositoryDirectory>
              <skipUnitTests>true</skipUnitTests>
            </configuration>

            <executions>
              <execution>
                <id>inject-localrepo-path</id>
                <phase>initialize</phase>
                <goals>
                  <goal>inject-local-repository-path</goal>
                </goals>
                <configuration>
                  <property>local.repo.path</property>
                </configuration>
              </execution>
              <execution>
                <id>stage-plugin</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>stage</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
      
    <profile>
      <id>integration-tests</id>
      <activation>
        <property>
          <name>integration-tests</name>
          <value>true</value>
        </property>
      </activation>
      
      <build>
        <testResources>
          <testResource>
            <directory>examples</directory>
            <targetPath>../projects</targetPath>
          </testResource>
        </testResources>

        <plugins>
          <!-- execute integration tests -->        
          <plugin>
            <artifactId>maven-invoker-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>integration-test</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>run</goal>
                </goals>
    
                <configuration>
                  <localRepositoryPath>${stagingLocalRepository}</localRepositoryPath>
                  <goalsFile>goals.txt</goalsFile>
                  <showErrors>true</showErrors>
                  <postBuildHookScript>verify.bsh</postBuildHookScript>
                  <streamLogs>true</streamLogs>
                  <!-- <debug>true</debug> -->
    
                  <projectsDirectory>${project.build.directory}/projects</projectsDirectory>
                  <pomIncludes>
                    <pomInclude>tc-manifest/pom.xml</pomInclude>
                    <pomInclude>tc-maven-plugin-sample/pom.xml</pomInclude>
                    <pomInclude>tc-maven-sample-surefire/pom.xml</pomInclude>
                    <pomInclude>tc-maven-webapp/pom.xml</pomInclude>
                  </pomIncludes>
                </configuration>
              </execution>
           </executions>
          </plugin>
        </plugins>
        
      </build>
    </profile>
  </profiles>
    
</project>
