Applications can be deployed to WildFly in many different ways. One of the typical ways it to use the wildfly-maven-plugin. This tech tip will provide details on that.
Actually, you just need to add wildfly-maven-plugin
to your pom.xml as:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.0.Beta1</version>
</plugin>
...
</plugins>
...
</build>
...
</project>
|
And that’s it!
Fire up a WildFly instance as explained in Tech Tip #1. Deploy your application to this WildFly instance using:
1
2
3
|
mvn wildfly:deploy
|
Simple, isn’t it ?
You can even start a WildFly instance defined by -Djboss-as.home
property and deploy the application using the following command:
1
2
3
|
mvn wildfly:run -Djboss-as.home=/Users/arungupta/workspaces/wildfly/build/target/wildfly-8.0.0.Final-SNAPSHOT
|
The property -Djboss-as.home
may not be specified in which case WildFly is downloaded and started and the application is deployed to it.
The version of WildFly to be downloaded can be optionally specified as:
1
2
3
|
mvn wildfly:run -Dwildfly.version=8.0.0.CR1
|
Now this application can be redeployed as:
1
2
3
|
mvn wildfly:redeploy
|
Or undeployed as:
1
2
3
|
mvn wildfly:undeploy
|
This plugin provide lots of other targets:
Goals | Description |
---|---|
wildfly:deploy-only |
Only deploy, without packaging |
wildfly:redeploy-only |
Redeploy, without packaging |
wildfly:add-resource |
Adds a resource to the server (only in domain mode) |
wildfly:add-artifact |
Adds an arbitrary artifact |
wildfly:execute-command |
Execute commands to the running instance, batch mode supported as well |
Refer to the plugin usage page and documentation for complete details.
Other deployment mechanisms such as jboss-cli, web-based admin console, REST API, and filesystem based will be covered in future blogs.
What is your typical way to deploy an application to WildFly ?
What is your deployment preference during development ? Does it differ from testing deployment phase ?
One thought on “WildFly Maven Plugin to Deploy Applications and Artifacts (Tech Tip #9)”