This tip will cover the most likely way to deploy deploy applications to WildFly, i.e. jboss-cli.

jboss-cli is Command Line Interface management tool for a standalone server or a managed domain. It is available in the “bin” directory of unzipped WildFly distribution and allows a user to connect to a standalone server or domain controller and execute management operations.

“jboss-cli” can be used to deploy applications using the interactive console or in a non-interactive manner.

Lets look at interactive first:

Use jboss-cli to connect with the existing standalone instance by giving the following command:

1

2

3

jboss-cli.sh-c

The -c switch connects using the default host (‘localhost’) and management port (‘9990’). These values are specified in ‘bin/jboss-cli.xml’ and can be updated.

This opens up the “jboss-cli” interactive console and shows the following prompt:

1

2

3

[standalone@localhost:9990/]

The prompt indicates that ‘jboss-cli’ is connected to a standalone instance’s management port.

Deploy the application by giving the following command in console:

1

2

3

deploy target/javaee7-1.0-SNAPSHOT.war

The directory name of the war file in the command may be different depending upon how ‘jboss-cli’ was invoked. Verify the server log to ensure that the application was redeployed. Look for specific timestamp in the log entries.

--force switch can be included in the command to replace the existing application.

Verify the deployment status by typing the following command deployment-info in the console:

1

2

3

deployment-info

and see the output as:

1

2

3

4

NAME RUNTIME-NAME PERSISTENT ENABLED STATUS

javaee7-1.0-SNAPSHOT.war javaee7-1.0-SNAPSHOT.war truetrueOK

Verify the server log to ensure that the application was deployed. Look for specific timestamp in the log entries.

Undeploy the application by giving the following command:

1

2

3

undeploy javaee7-1.0-SNAPSHOT.war

Type “exit” or “quit” to exit the interactive console.

Now lets look at how these commands can be issued non-interactively very easily.