The exec-cli-script and exec-cli-command goals will let you start an RHQ CLI in order to execute either a script or a command.
By default, the CLI will start disconnected. You can configure both mojos to login to a remote RHQ server with the following properties:
By default, CLI script argument style is indexed. You can change this to named using the argsStyle property.
... <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> <argsStyle>indexed</argsStyle> </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> ...