Search code examples
javamavenejbpom.xml

How to configure maven cargo to download deploy Wildfly 10 and add a test user?


I found this setting on maven cargo:

<plugin>
    <inherited>false</inherited>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven3-plugin</artifactId>
    <configuration>
        <container>
            <containerId>wildfly10x</containerId>
            <zipUrlInstaller>
                <url>http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip</url>
                <downloadDir>${project.basedir}/.cargo/downloads</downloadDir>
                <extractDir>${project.basedir}
                    /.cargo/extracts</extractDir>
            </zipUrlInstaller>
        </container>
    </configuration>
    <executions>
        <execution>
            <id>install-cargo</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>install</goal>
            </goals>
        </execution>
    </executions>
</plugin>

But this does not seem to work.

Can anyone provide me the correct configuration.

Also I want to add a user. How to do that?


Solution

  • This is what worked for me:

    <profiles>
            <!-- mvn clean package cargo:run -->
            <profile>
                <id>wildfly-standalone</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.codehaus.cargo</groupId>
                            <artifactId>cargo-maven2-plugin</artifactId>
                            <version>${cargo-maven2-plugin.version}</version>
    
                            <configuration>
    
                                <container>
                                    <containerId>wildfly10x</containerId>
                                    <zipUrlInstaller>
                                        <url>http://download.jboss.org/wildfly/10.1.0.Final/wildfly-10.1.0.Final.zip</url>
                                    </zipUrlInstaller>
                                </container>
    
                                <configuration>
                                    <properties>
                                        <cargo.hostname>127.0.0.1</cargo.hostname>
                                        <cargo.jboss.management-http.port>9990</cargo.jboss.management-http.port>
                                        <cargo.servlet.users>testUser:admin1234!</cargo.servlet.users>
                                    </properties>
                                </configuration>
    
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
    

    To download and install the settings you need to run the following command:

    mvn clean package cargo:run