WildFly Maven Plugin to Deploy Applications and Artifacts (Tech Tip #9)

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 ?

Be Sociable, Share!
  • Tweet
This entry was posted in techtip, wildfly and tagged . Bookmark the permalink.

One Response to WildFly Maven Plugin to Deploy Applications and Artifacts (Tech Tip #9)

  1. Pingback: Deploy to WildFly using curl (Tech Tip #10) | Miles to go 2.0 …

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>