## wildfly:execute-commands

Full name:

org.wildfly.plugins:wildfly-maven-plugin:5.0.0.Beta3:execute-commands

Description:

Execute commands to the running WildFly Application Server.

Commands should be formatted in the same manner CLI commands are formatted.

Executing commands in a batch will rollback all changes if one command fails.

         <batch>true</batch>
         <fail-on-error>false</fail-on-error>
         <commands>
             <command>/subsystem=logging/console=CONSOLE:write-attribute(name=level,value=DEBUG)</command>
         </commands>

Attributes:

- Requires a Maven project to be executed.
- The goal is thread-safe and supports parallel builds.

### Optional Parameters

Name | Type | Since | Description
--- | --- | --- | ---
`<authenticationConfig>` | `URL` | `-` | A URL which points to the authentication configuration (`wildfly-config.xml`) the client uses to authenticate with the server. User Property: `wildfly.authConfig` Alias: `authentication-config`
`<autoReload>` | `boolean` | `4.2.1` | Automatically reloads the server if the commands leave the server in the "reload-required" state. Note a reload will not be done if `offline` is set to `true`. Default: `true` User Property: `wildfly.auto.reload` Alias: `auto-reload`
`<batch>` | `boolean` | `-` | `true` if commands should be executed in a batch or `false` if they should be executed one at a time. Default: `false` User Property: `wildfly.batch`
`<commands>` | `List<String>` | `-` | The CLI commands to execute. User Property: `wildfly.commands`
`<failOnError>` | `boolean` | `-` | Indicates whether or not subsequent commands should be executed if an error occurs executing a command. A value of `false` will continue processing commands even if a previous command execution results in a failure. Note that this value is ignored if `offline` is set to `true`. Default: `true` User Property: `wildfly.failOnError` Alias: `fail-on-error`
`<fork>` | `boolean` | `2.0.0` | Indicates the commands should be run in a new process. If the `jboss-home` property is not set an attempt will be made to download a version of WildFly to execute commands on. However it's generally considered best practice to set the `jboss-home` property if setting this value to `true`. Note that if `offline` is set to `true` this setting really has no effect. WARNING: In 3.0.0 you'll be required to set the `jboss-home`. An error will occur if this option is `true` and the `jboss-home` is not set. Default: `false` User Property: `wildfly.fork`
`<hostname>` | `String` | `-` | Specifies the host name of the server where the deployment plan should be executed. Default: `localhost` User Property: `wildfly.hostname`
`<id>` | `String` | `-` | Specifies the id of the server if the username and password is to be retrieved from the settings.xml file User Property: `wildfly.id`
`<javaOpts>` | `String[]` | `-` | The JVM options to pass to the offline process if the `offline` configuration parameter is set to `true`. User Property: `wildfly.javaOpts` Alias: `java-opts`
`<jbossHome>` | `String` | `-` | The WildFly Application Server's home directory. This parameter is required when `offline` is set to `true`. Otherwise this is not required, but should be used for commands such as `module add` as they are executed on the local file system. User Property: `jboss-as.home` Alias: `jboss-home`
`<offline>` | `boolean` | `-` | Indicates whether or not CLI scrips or commands should be executed in an offline mode. This is useful for using an embedded server or host controller. This does not start an embedded server it instead skips checking if a server is running. Default: `false` User Property: `wildfly.offline`
`<password>` | `String` | `-` | Specifies the password to use if prompted to authenticate by the server. If no password is specified and the server requests authentication the user will be prompted to supply the password, User Property: `wildfly.password`
`<port>` | `int` | `-` | Specifies the port number the server is listening on. Default: `9990` User Property: `wildfly.port`
`<propertiesFiles>` | `List<File>` | `-` | The properties files to use when executing CLI scripts or commands.
`<protocol>` | `String` | `-` | The protocol used to connect to the server for management. User Property: `wildfly.protocol`
`<resolveExpressions>` | `boolean` | `3.0` | Resolve expressions prior to send the commands to the server. Default: `false` User Property: `wildfly.resolveExpressions` Alias: `resolve-expressions`
`<scripts>` | `List<File>` | `-` | The CLI script files to execute. User Property: `wildfly.scripts`
`<skip>` | `boolean` | `-` | `true` if commands execution should be skipped. Default: `false` User Property: `wildfly.skip`
`<stdout>` | `String` | `-` | Indicates how `stdout` and `stderr` should be handled for the spawned CLI process. Currently a new process is only spawned if `offline` is set to `true` or `fork` is set to `true`. Note that `stderr` will be redirected to `stdout` if the value is defined unless the value is `none`. By default `stdout` and `stderr` are inherited from the current process. You can change the setting to one of the follow: `none` indicates the `stdout` and `stderr` stream should not be consumed `System.out` or `System.err` to redirect to the current processes (use this option if you see odd behavior from maven with the default value) Any other value is assumed to be the path to a file and the `stdout` and `stderr` will be written there Default: `System.out` User Property: `wildfly.stdout`
`<systemProperties>` | `Map<String,String>` | `-` | The system properties to be set when executing CLI commands. Alias: `system-properties`
`<timeout>` | `int` | `-` | The timeout, in seconds, to wait for a management connection. Default: `60` User Property: `wildfly.timeout`
`<username>` | `String` | `-` | Specifies the username to use if prompted to authenticate by the server. If no username is specified and the server requests authentication the user will be prompted to supply the username, User Property: `wildfly.username`

### Parameter Details

#### <authenticationConfig>

A URL which points to the authentication configuration (`wildfly-config.xml`) the client uses to authenticate with the server.

- Type: `java.net.URL`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.authConfig`
- Alias: `authentication-config`

#### <autoReload>

Automatically reloads the server if the commands leave the server in the "reload-required" state. Note a reload will not be done if `offline` is set to `true`.

- Type: `boolean`
- Since: `4.2.1`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.auto.reload`
- Default: `true`
- Alias: `auto-reload`

#### <batch>

`true` if commands should be executed in a batch or `false` if they should be executed one at a time.

- Type: `boolean`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.batch`
- Default: `false`

#### <commands>

The CLI commands to execute.

- Type: `java.util.List<java.lang.String>`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.commands`

#### <failOnError>

Indicates whether or not subsequent commands should be executed if an error occurs executing a command. A value of `false` will continue processing commands even if a previous command execution results in a failure.

Note that this value is ignored if `offline` is set to `true`.

- Type: `boolean`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.failOnError`
- Default: `true`
- Alias: `fail-on-error`

#### <fork>

Indicates the commands should be run in a new process. If the `jboss-home` property is not set an attempt will be made to download a version of WildFly to execute commands on. However it's generally considered best practice to set the `jboss-home` property if setting this value to `true`.

Note that if `offline` is set to `true` this setting really has no effect.

WARNING: In 3.0.0 you'll be required to set the `jboss-home`. An error will occur if this option is `true` and the `jboss-home` is not set.

- Type: `boolean`
- Since: `2.0.0`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.fork`
- Default: `false`

#### <hostname>

Specifies the host name of the server where the deployment plan should be executed.

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.hostname`
- Default: `localhost`

#### <id>

Specifies the id of the server if the username and password is to be retrieved from the settings.xml file

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.id`

#### <javaOpts>

The JVM options to pass to the offline process if the `offline` configuration parameter is set to `true`.

- Type: `java.lang.String[]`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.javaOpts`
- Alias: `java-opts`

#### <jbossHome>

The WildFly Application Server's home directory.

This parameter is required when `offline` is set to `true`. Otherwise this is not required, but should be used for commands such as `module add` as they are executed on the local file system.

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `jboss-as.home`
- Alias: `jboss-home`

#### <offline>

Indicates whether or not CLI scrips or commands should be executed in an offline mode. This is useful for using an embedded server or host controller.

This does not start an embedded server it instead skips checking if a server is running.

- Type: `boolean`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.offline`
- Default: `false`

#### <password>

Specifies the password to use if prompted to authenticate by the server.

If no password is specified and the server requests authentication the user will be prompted to supply the password,

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.password`

#### <port>

Specifies the port number the server is listening on.

- Type: `int`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.port`
- Default: `9990`

#### <propertiesFiles>

The properties files to use when executing CLI scripts or commands.

- Type: `java.util.List<java.io.File>`
- Required: `report.plugin.goal.no`

#### <protocol>

The protocol used to connect to the server for management.

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.protocol`

#### <resolveExpressions>

Resolve expressions prior to send the commands to the server.

- Type: `boolean`
- Since: `3.0`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.resolveExpressions`
- Default: `false`
- Alias: `resolve-expressions`

#### <scripts>

The CLI script files to execute.

- Type: `java.util.List<java.io.File>`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.scripts`

#### <skip>

`true` if commands execution should be skipped.

- Type: `boolean`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.skip`
- Default: `false`

#### <stdout>

Indicates how `stdout` and `stderr` should be handled for the spawned CLI process. Currently a new process is only spawned if `offline` is set to `true` or `fork` is set to `true`. Note that `stderr` will be redirected to `stdout` if the value is defined unless the value is `none`.
By default `stdout` and `stderr` are inherited from the current process. You can change the setting to one of the follow:

- `none` indicates the `stdout` and `stderr` stream should not be consumed
- `System.out` or `System.err` to redirect to the current processes (use this option if you see odd behavior from maven with the default value)
- Any other value is assumed to be the path to a file and the `stdout` and `stderr` will be written there

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.stdout`
- Default: `System.out`

#### <systemProperties>

The system properties to be set when executing CLI commands.

- Type: `java.util.Map<java.lang.String, java.lang.String>`
- Required: `report.plugin.goal.no`
- Alias: `system-properties`

#### <timeout>

The timeout, in seconds, to wait for a management connection.

- Type: `int`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.timeout`
- Default: `60`

#### <username>

Specifies the username to use if prompted to authenticate by the server.

If no username is specified and the server requests authentication the user will be prompted to supply the username,

- Type: `java.lang.String`
- Required: `report.plugin.goal.no`
- User Property: `wildfly.username`