<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.11.0</version>
    <relativePath>../../../pom.xml</relativePath>
  </parent>

  <groupId>org.rhq</groupId>
  <artifactId>rhq-enterprise-comm</artifactId>
  <packaging>jar</packaging>

  <name>RHQ Enterprise Agent-Server Communications Layer</name>
  <description>RHQ Enterprise Agent-Server Communications Layer</description>

  <properties>
    <!-- Ports used by unit tests - can be overridden via profiles in settings.xml -->
    <rhq.comm.test.connectorBindPort>33333</rhq.comm.test.connectorBindPort>
    <rhq.comm.test.connector2BindPort>62621</rhq.comm.test.connector2BindPort>
  </properties>

  <dependencies>

    <!-- Internal Deps -->

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

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

    <!-- 3rd Party Deps -->

    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <exclusions>
         <exclusion>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <!-- provided by J2SE 1.4+ -->
         </exclusion>
       </exclusions>
    </dependency>

    <dependency>
      <groupId>gnu-getopt</groupId>
      <artifactId>getopt</artifactId>
      <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
    </dependency>

    <dependency>
      <groupId>i18nlog</groupId>
      <artifactId>i18nlog</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss</groupId>
      <artifactId>jboss-common-core</artifactId>
    </dependency>

    <dependency>
      <groupId>jboss</groupId>
      <artifactId>jboss-jmx</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.remoting</groupId>
      <artifactId>jboss-remoting</artifactId>
    </dependency>

    <dependency>
      <groupId>jboss</groupId>
      <artifactId>jboss-serialization</artifactId>
    </dependency>

    <dependency>
      <groupId>oswego-concurrent</groupId>
      <artifactId>concurrent</artifactId>
    </dependency>

  </dependencies>

  <build>
    <plugins>

      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <configuration>
              <target>
                <!-- generate the I18N resource bundles -->
                <taskdef name="i18n" classpathref="maven.runtime.classpath" classname="mazz.i18n.ant.I18NAntTask" />

                <i18n outputdir="${project.build.outputDirectory}" defaultlocale="en" verbose="false" append="false" verify="true">
                   <classpath refid="maven.runtime.classpath" />
                   <classfileset dir="${project.build.outputDirectory}">
                      <include name="**/CommI18NResourceKeys.class" />
                   </classfileset>
                </i18n>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Product-Name>${rhq.product.name}</Product-Name>
              <Product-Version>${project.version}</Product-Version>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
          <!-- enabling this overrides -Dmaven.test.skip
          <skip>false</skip>
          -->
          <!--
          <argLine>${jacoco.unit-test.args} -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
          -->
          <systemPropertyVariables combine.children="append">
            <rhq.comm.test.connectorBindPort>${rhq.comm.test.connectorBindPort}</rhq.comm.test.connectorBindPort>
            <rhq.comm.test.connector2BindPort>${rhq.comm.test.connector2BindPort}</rhq.comm.test.connector2BindPort>
          </systemPropertyVariables>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <reporting>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-report-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>

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

