<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-core-parent</artifactId>
      <version>3.0.0.B06</version>
   </parent>

   <groupId>org.rhq</groupId>
   <artifactId>rhq-core-plugin-container</artifactId>
   <packaging>jar</packaging>

   <name>RHQ Plugin Container</name>
   <description>RHQ plugin container</description>

   <scm>
     <connection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/core/plugin-container</connection>
     <developerConnection>scm:git:ssh://git.fedorahosted.org/git/rhq.git/modules/core/plugin-container</developerConnection>
   </scm>

   <properties>
     <scm.module.path>modules/core/plugin-container/</scm.module.path>
   </properties>

   <dependencies>

      <!-- Internal Deps -->

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

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

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

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

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

      <!-- 3rd Party Deps -->

      <dependency>
         <groupId>javax.xml.bind</groupId>
         <artifactId>jaxb-api</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
      </dependency>

      <dependency>
         <groupId>com.sun.xml.bind</groupId>
         <artifactId>jaxb-impl</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
         <!--<scope>test</scope>  not sure about this -->
      </dependency>

      <!-- TODO: This is a fix for the Javac bug requiring annotations to be
           available when compiling dependent classes. It is fixed in JDK 6 -->
      <dependency>
         <groupId>javax.persistence</groupId>
         <artifactId>persistence-api</artifactId>
         <version>1.0</version>
         <scope>provided</scope>
      </dependency>
      <dependency>
        <groupId>jboss.jboss-embeddable-ejb3</groupId>
        <artifactId>hibernate-all</artifactId>
        <version>1.0.0.Alpha9</version>
        <scope>provided</scope> <!-- by ON Container -->
        <!-- needed for referenced domain entities that use Hibernate annotations -->
      </dependency>
      
      <dependency>
         <groupId>org.hyperic</groupId>
         <artifactId>sigar</artifactId>
         <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
      </dependency>

      <dependency>
         <groupId>${groupId}</groupId>
         <artifactId>test-utils</artifactId>
         <version>${version}</version>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
         <version>1.4</version>
         <scope>test</scope>
      </dependency>
      
   </dependencies>

  <build>
    <plugins>

      <!-- need to copy/unzip the SIGAR native libraries to the target directory and tell SIGAR where they are -->
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-test-resources</phase>
            <configuration>
              <tasks>
                 <echo>SIGAR java library version used is ${sigar.version}</echo>
                 <echo>Copying/unzipping SIGAR native libraries (version ${sigar.version}) to local build directory</echo>
                 <mkdir dir="${project.build.directory}/jboss-sigar" />
                 <copy toDir="${project.build.directory}/jboss-sigar">
                    <fileset dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}" includes="*.zip" />
                 </copy>
                 <unzip dest="${project.build.directory}/jboss-sigar">
                    <fileset dir="${project.build.directory}/jboss-sigar" includes="*.zip" />
                    <patternset>
                       <include name="**/lib/sigar.jar" />
                       <include name="**/lib/bcel*.jar" />
                       <include name="**/lib/*.so" />
                       <include name="**/lib/*.sl" />
                       <include name="**/lib/*.dll" />
                       <include name="**/lib/*.dylib" />
                    </patternset>
                 </unzip>
                 <move todir="${project.build.directory}/jboss-sigar" flatten="true">
                    <fileset dir="${project.build.directory}/jboss-sigar">
                       <include name="**/lib/*" />
                    </fileset>
                 </move>
                 <delete dir="${project.build.directory}/jboss-sigar/hyperic-sigar-${sigar.version}" />
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
             <rhq.version>${project.version}</rhq.version>
          </systemPropertyVariables>

          <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
          <!-- need to point the library path to the location of the native libraries -->
          <argLine>-Dorg.hyperic.sigar.path=${project.build.directory}/jboss-sigar</argLine>
          <!--
          <argLine>-Dorg.hyperic.sigar.path=${project.build.directory}/jboss-sigar -Dsigar.nativeLogging=true</argLine>
           -->
        </configuration>
      </plugin>

    </plugins>
  </build>   

   <pluginRepositories>
      <pluginRepository>
         <id>java.net</id>
         <name>java.net Maven Repository</name>
         <url>http://download.java.net/maven/1/</url>
         <layout>legacy</layout>
         <snapshots>
            <enabled>false</enabled>
         </snapshots>
      </pluginRepository>
   </pluginRepositories>

   <repositories>

      <repository>
         <id>java.net</id>
         <name>java.net Maven Repository</name>
         <url>http://download.java.net/maven/1/</url>
         <layout>legacy</layout>
         <snapshots>
            <enabled>false</enabled>
         </snapshots>
      </repository>

      <!-- This is for SIGAR 1.6.4. -->
      <repository>
          <id>jboss-thirdparty-uploads</id>
          <name>JBoss Third Party Uploads</name>
          <url>https://repository.jboss.org/nexus/content/repositories/thirdparty-uploads/</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
      </repository>

   </repositories>

</project>

