Deploy/Undeploy Examples

Deploying your application

The plugin goals deploy, undeploy, and redeploy can be used to deploy, redeploy and undeploy applications to a JBoss Application Server. The first step is to add the appropriate configuration to your plugin configuration in the POM.

<project>
    ...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.1.0.CR1b</version>
            </plugin>
            ...
        </plugins>
        ...
    </build>
...
</project>

The file listed under the filename parameter can be deployed to the server using the deploy goal.

  mvn jboss-as:deploy

The file can later be redeployed or undeployed using the appropriate goals.

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

You can also set the deployment operation to execute at a specific phase, for example the install phase.

<project>
    ...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.1.0.CR1b</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            ...
        </plugins>
        ...
    </build>
...
</project>

Deploying other artifacts

It is also possible to deploy other artifacts that are not related to your deployment, e.g. database drivers:

<project>
    ...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.1.0.CR1b</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy-artifact</goal>
                        </goals>
                        <configuration>
                            <groupId>postgresql</groupId>
                            <artifactId>postgresql</artifactId>
                            <name>postgresql.jar</name>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            ...
        </plugins>
        ...
    </build>
...
</project>

The artifact must be already listed as a dependency in the projects pom.xml.