The execute-commands goal allows you to execute commands, in the CLI format, on the running WildFly.
The example below shows how to add a debug logger with a debug log file:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.2.Final</version>
<configuration>
<commands>
<command>/subsystem=logging/file-handler=debug:add(level=DEBUG,autoflush=true,file={"relative-to"=>"jboss.server.log.dir", "path"=>"debug.log"})</command>
<command>/subsystem=logging/logger=org.jboss.as:add(level=DEBUG,handlers=[debug])</command>
</commands>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
</project>The example below shows how to execute commands from a CLI script:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.2.2.Final</version>
<configuration>
<scripts>
<script>config.cli</script>
</scripts>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
</project>Example of a CLI script to set the transaction timeout to 600 seconds.
batch # set default transaction timeout /subsystem=transactions :write-attribute(name=default-timeout, value=600) #... # Execute and reload run-batch :reload
The example below shows how to execute commands offline from a CLI script, which is useful for running scripts that embed server or host controller.
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.org.wildfly.plugin}</version>
<executions>
....
</executions>
<configuration>
<!-- Tells plugin to start in offline mode, to not try to connect to server or start it-->
<offline>true</offline>
<scripts>
<script>scrip-name.cli</script>
</scripts>
<jboss-home>${wildfly.dir}</jboss-home>
<!-- where to out log-->
<stdout>/home/jperkins/projects/jboss/wildfly/wildfly-maven-plugin/plugin/target/wildfly-plugin.log</stdout>
<!-- java opts with which CLI is started with -->
<java-opts>${modular.jdk.args}</java-opts>
<!-- system properties that can than be referenced in CLI script-->
<system-properties>
<public.ip>${node0}</public.ip>
....
</system-properties>
</configuration>
</plugin>
...
</plugins>
...
</build>
...
</project>