Skip navigation
2013

This piece of information isn't easy to google up as a compact whole, so here you go:

 

The maven jboss-as plugin serves for easy deployment as a part of a build or just through maven.

First you have to add the plugin to pom.xml so maven knows about it:

 

<!-- JBoss AS plugin to deploy the war. -->
<plugin>
    <groupId>org.jboss.as.plugins</groupId>
    <artifactId>jboss-as-maven-plugin</artifactId>
    <version>7.4.Final</version>
    <configuration>
        <hostname>${jboss-as.deploy.hostname}</hostname>
        <fileNames>
            <fileName>target/${plugin.war.warName}.war</fileName>
        </fileNames>
    </configuration>
</plugin>




 

Notice that the <hostname> and <fileName> is generic so you can set the properties for devel, test and prod environment.

 

Then, simply follow the docs of the plugin:

 

mvn jboss-as:deploy
mvn jboss-as:undeploy
mvn jboss-as:redeploy




 

It's a bit inconvenient that you have to keep in mind whether the app is deployed or not and use deploy or redeploy accordingly.

 

When you run this goal, by default, it runs the 'package' phase first. If you just want to redeploy what's already built, use the 'redeploy-only' goal.

 

Customizing for different environments

 

A hint about how to customize:

First, provide the defaults.

 

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- Local vs. OpenShift vs. production. Controlled in profiles. -->
    <jboss-as.deploy.hostname>localhost</jboss-as.deploy.hostname>  <!-- Where to deploy. -->
    <jboss-as.deploy.user>jboss-as.deploy.user is not defined (try settings.xml).</jboss-as.deploy.user>
    <jboss-as.deploy.pass>jboss-as.deploy.pass is not defined (try settings.xml).</jboss-as.deploy.pass>
    <plugin.war.warName>${project.build.finalName}</plugin.war.warName>  <!-- To change to ROOT for "prod", to go to / context. -->
</properties>

(The user and pass are not used in this example but you may need/want to.)

 

Then, in profiles, add the specifics.

In the OpenShift profile, the war is not deployed by maven - rather by openshift itself, after the build.

For production environment, we change the name to ROOT.war.

 

<profiles>
    <!-- OpenShift. -->
    <profile>
        <id>openshift</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <outputDirectory>deployments</outputDirectory>
                        <warName>ROOT</warName>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

    <!-- Production. -->
    <profile>
        <id>prod</id>
        <activation> <property><name>prod</name></property> </activation>
        <properties>
            <wicket.mode>development</wicket.mode> <!-- development | deployment -->
            <jboss-as.deploy.hostname>products.app.eng.bos.redhat.com</jboss-as.deploy.hostname>
            <plugin.war.warName>ROOT</plugin.war.warName>
        </properties>
        <!-- JBoss AS plugin - deploy automatically. -->
        <build>
            <plugins>
                <plugin>
                    <groupId>org.jboss.as.plugins</groupId>
                    <artifactId>jboss-as-maven-plugin</artifactId>
                    <configuration>
                        <force>true</force>
                        <username>admin</username>
                        <password>${essc.deploy.pass.prod}</password>
                        <filename>ROOT.war</filename>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

</profiles>

WindRide is a standalone application which helps with migration of configuration of application servers to JBoss AS 7, JBoss EAP 6 or WildFly.

See the project's wiki and other posts in this blog: Ondrej Zizka's Blog

 

Currently, the only supported source servers are JBoss AS 5 and JBoss EAP 5.

 

Anyone interested in supporting GlassFish as a source server, too?

If someone expresses some interest, it might cause this feature to land in the WindRide project sooner.

 

Comment / like / share.