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:
<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:
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:
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:
mvn wildfly:run -Dwildfly.version=8.0.0.CR1
Now this application can be redeployed as:
mvn wildfly:redeploy
Or undeployed as:
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 ?
Pingback: Deploy to WildFly using curl (Tech Tip #10) | Miles to go 2.0 …