<!--
  ~ /*
  ~  * RHQ Management Platform
  ~  * Copyright (C) 2005-2012 Red Hat, Inc.
  ~  * All rights reserved.
  ~  *
  ~  * This program is free software; you can redistribute it and/or modify
  ~  * it under the terms of the GNU General Public License, version 2, as
  ~  * published by the Free Software Foundation, and/or the GNU Lesser
  ~  * General Public License, version 2.1, also as published by the Free
  ~  * Software Foundation.
  ~  *
  ~  * This program 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 and the GNU Lesser General Public License
  ~  * for more details.
  ~  *
  ~  * You should have received a copy of the GNU General Public License
  ~  * and the GNU Lesser General Public License along with this program;
  ~  * if not, write to the Free Software Foundation, Inc.,
  ~  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  ~  */
  -->

<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.rhq</groupId>
    <artifactId>rhq-parent</artifactId>
    <version>4.8.0</version>
    <relativePath>../../../../pom.xml</relativePath>
  </parent>

  <artifactId>rhq-server-metrics</artifactId>
  <name>RHQ Server Metrics</name>

  <properties>
    <skipClusterShutdown>false</skipClusterShutdown>
    <clusterDir>${project.build.directory}/cassandra</clusterDir>
    <deployCluster>true</deployCluster>
  </properties>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rhq-cassandra-ccm-core</artifactId>
      <version>${project.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apache.cassandra</groupId>
          <artifactId>cassandra-clientutil</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rhq-cassandra-ccm-testng</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>rhq-core-domain</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>test-utils</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-nop</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
    </dependency>

    <dependency>
      <groupId>com.datastax.cassandra</groupId>
      <artifactId>cassandra-driver-core</artifactId>
      <version>${cassandra.driver.version}</version>
    </dependency>

    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <version>2.1</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.1</version>
    </dependency>

    <dependency>
      <groupId>commons-cli</groupId>
      <artifactId>commons-cli</artifactId>
      <version>1.2</version>
    </dependency>

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
    </dependency>

    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </dependency>

    <dependency>
      <groupId>postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <!-- NOTE: version defined in root pom dependencyManagement section -->
    </dependency>

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
    </dependency>

    <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-testng</artifactId>
      <version>${powermock.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
       <groupId>org.powermock</groupId>
       <artifactId>powermock-api-mockito</artifactId>
       <version>${powermock.version}</version>
       <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <rhq.cassandra.cluster.skip-shutdown>${skipClusterShutdown}</rhq.cassandra.cluster.skip-shutdown>
            <rhq.cassandra.cluster.dir>${rhq.cassandra.cluster.dir}</rhq.cassandra.cluster.dir>
            <rhq.cassandra.cluster.deploy>${deployCluster}</rhq.cassandra.cluster.deploy>
          </systemPropertyVariables>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>dev</id>
      <properties>
        <rhq.rootDir>../../..</rhq.rootDir>
        <rhq.containerDir>${rhq.rootDir}/${rhq.devContainerServerPath}</rhq.containerDir>
        <rhq.deploymentDir>${rhq.containerDir}/${rhq.earLibDir}</rhq.deploymentDir>
      </properties>

      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>deploy</id>
                <phase>package</phase>
                <configuration>
                  <target>
                    <mkdir dir="${rhq.deploymentDir}"/>
                    <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar"/>
                    <echo>*** Updating ${deployment.file}...</echo>
                    <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}"/>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>

              <execution>
                <id>undeploy</id>
                <phase>clean</phase>
                <configuration>
                  <target>
                    <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar"/>
                    <echo>*** Deleting ${deployment.file}...</echo>
                    <delete file="${deployment.file}"/>
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
         </plugins>
      </build>
    </profile>
   </profiles>
</project>
