# Run Examples

The run goal allows you to run a local instance of WildFly.

## Run overriding the feature pack location

The example below shows how to run a server overriding the feature pack location:

    <project>
        ...
        <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>4.2.0.Final</version>
                    <configuration>
                        <feature-pack-location>wildfly-preview@maven(org.jboss.universe:community-universe)</feature-pack-location>
                    </configuration>
                </plugin>
                ...
            </plugins>
            ...
        </build>
    ...
    </project>

## Run Example

The example below shows how to run a server with multiple module paths:

    <project>
        ...
        <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>4.2.0.Final</version>
                    <configuration>
                        <modules-path>
                            <paths>
                                <path>/opt/WildFly/modules</path>
                                <path>/opt/my-modules</path>
                            </paths>
                        </modules-path>
                    </configuration>
                </plugin>
                ...
            </plugins>
            ...
        </build>
    ...
    </project>

## Run with different port

The example below shows how to run a server with the management port running a different port.

    <project>
        ...
        <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>4.2.0.Final</version>
                    <configuration>
                        <jboss-home>/opt/WildFly</jboss-home>
                        <modules-path>/opt/WildFly/modules</modules-path>
                        <port>9999</port>
                    </configuration>
                </plugin>
                ...
            </plugins>
            ...
        </build>
    ...
    </project>

## Run with a different base directory

The example below shows how to run a server with a different base directory.

    <project>
        ...
        <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>4.2.0.Final</version>
                    <configuration>
                        <server-args>
                            <server-arg>-Djboss.server.base.dir=/opt/WildFly/standalone/</server-arg>
                            <server-arg>-b=0.0.0.0</server-arg>
                        </server-args>
                    </configuration>
                </plugin>
                ...
            </plugins>
            ...
        </build>
    ...
    </project>

## Add a user before running the server

The example below shows how to add a user before running the server

    <project>
        ...
        <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>4.2.0.Final</version>
                    <configuration>
                        <add-user>
                            <users>
                                <user>
                                    <username>admin</username>
                                    <password>admin.1234</password>
                                </user>
                                <user>
                                    <username>admin-user</username>
                                    <password>user.1234</password>
                                    <groups>
                                        <group>admin</group>
                                        <group>user</group>
                                    </groups>
                                    <application-user>true</application-user>
                                </user>
                                <user>
                                    <username>default-user</username>
                                    <password>user.1234</password>
                                    <groups>
                                        <group>user</group>
                                    </groups>
                                    <application-user>true</application-user>
                                </user>
                            </users>
                        </add-user>
                    </configuration>
                </plugin>
                ...
            </plugins>
            ...
        </build>
    ...
    </project>

## Enable debugging

The example below shows how to run a server with debugging enabled

    <project>
        ...
        <build>
            ...
            <plugins>
                ...
                <plugin>
                    <groupId>org.wildfly.plugins</groupId>
                    <artifactId>wildfly-maven-plugin</artifactId>
                    <version>4.2.0.Final</version>
                    <configuration>
                        <debug>true</debug>
                        <debugPort>5005</debugPort>
                        <debugSuspend>true</debugSuspend>
                    </configuration>
                </plugin>
                ...
            </plugins>
            ...
        </build>
    ...
    </project>