<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>
<groupId>com.mycompany.rhq.agent.plugins</groupId>
<artifactId>my-custom-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- This project has the custom plugin packaging -->
<packaging>rhq-agent-plugin</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<rhq.version>4.11.0</rhq.version>
</properties>
<dependencies>
<!-- Dependencies provided by the plugin container -->
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-domain</artifactId>
<version>${rhq.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-plugin-api</artifactId>
<version>${rhq.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-native-system</artifactId>
<version>${rhq.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<!-- Dependencies required by your plugin -->
<!-- All dependencies under RUNTIME scope will be included in the plugin archive -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.3</version>
</dependency>
<!-- Some test dependencies -->
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-plugin-container</artifactId>
<version>${rhq.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
<artifactId>test-utils</artifactId>
<version>${rhq.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-plugin-container</artifactId>
<version>${rhq.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- This is to get the Maven version available as a property -->
<!-- It will be used to customize the archive manifest file -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>maven-version</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Here comes the RHQ agent plugin plugin -->
<plugin>
<groupId>org.rhq.maven.plugins</groupId>
<artifactId>rhq-agent-plugin-plugin</artifactId>
<version>0.2</version>
<!-- Tell Maven that this plugin will extend the standard lifecycle and packaging -->
<!-- Without this the build fails to recognize the custom packaging -->
<extensions>true</extensions>
<configuration>
<!-- Here comes the project manifest customization -->
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Maven-Version>${maven.version}</Maven-Version>
<Java-Version>${java.version}</Java-Version>
<Java-Vendor>${java.vendor}</Java-Vendor>
<Os-Name>${os.name}</Os-Name>
<Os-Arch>${os.arch}</Os-Arch>
<Os-Version>${os.version}</Os-Version>
<Build-Number>${buildNumber}</Build-Number>
<Build-Time>${buildTime}</Build-Time>
</manifestEntries>
</archive>
<deployDirectory>/path/to/dev/container/plugins/dir</deployDirectory>
</configuration>
<executions>
<!-- Here we configure the execution of optional mojos -->
<execution>
<id>validate-the-plugin</id>
<goals>
<goal>validate</goal>
</goals>
<phase>package</phase>
<configuration>
<rhqVersion>${rhq.version}</rhqVersion>
</configuration>
</execution>
<execution>
<id>deploy-to-dev-container</id>
<goals>
<goal>deploy</goal>
</goals>
<phase>package</phase>
</execution>
<execution>
<id>upload-to-rhq-server</id>
<goals>
<goal>upload</goal>
</goals>
<phase>package</phase>
<configuration>
<!-- Optional, defaults to http -->
<scheme>http</scheme>
<host>rhqserver.mycorp.int</host>
<port>7080</port> <!-- Optional, defaults to 7080 -->
<!-- The user must have appropriate permissions (MANAGE_SETTINGS) -->
<username>rhqadmin</username>
<password>secret</password>
<!-- Whether a plugin scan should be triggered on the server after upload. Optional, defaults to true -->
<startScan>true</startScan>
<!-- Whether to fail the build if an error occurs while uploading. Optional, defaults to false -->
<failOnError>false</failOnError>
</configuration>
</execution>
<execution>
<id>exec-cli-script</id>
<phase>package</phase>
<goals>
<goal>exec-cli-script</goal>
</goals>
<configuration>
<rhqVersion>${rhq.version}</rhqVersion>
<scriptFile>${basedir}/src/cli-scripts/sample.js</scriptFile>
<args>
<arg>Maven Invoker</arg>
<arg>${project.build.directory}/sample.js.out</arg>
</args>
</configuration>
</execution>
<execution>
<id>exec-cli-command</id>
<phase>package</phase>
<goals>
<goal>exec-cli-command</goal>
</goals>
<configuration>
<rhqVersion>${rhq.version}</rhqVersion>
<command>scriptUtil.saveBytesToFile(new java.lang.String("Hello!").getBytes(), "${project.build.directory}/cli-command.out")</command>
</configuration>
</execution>
<execution>
<id>setup-test-plugin-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>setup-test-plugin-container</goal>
</goals>
<configuration>
<rhqVersion>${rhq.version}</rhqVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>itest/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<includes>
<include>itest/**</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<argLine>-Dorg.hyperic.sigar.path=${project.build.directory}/itest/lib</argLine>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>