Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add user to WildFly via Maven

  1. I create a maven project
  2. Declares WildFly as a dependence in the area
  3. Declares a wildfly-maven-plugin as a dependency in the space
  4. I run mvn wildfly: start
  5. I start localhost: 9990
  6. I see a message that I have to add a user

Question

How to add this user? in WildFly with no Maven it is natural to enter wildfly/bin and run add-user.sh but how to do it well in Maven project, finally I go do target/wildfly-run/wildfly-12.0.0.Final/bin/add-user.sh but I'm guessing that this should not be good..

like image 928
aprzybyła Avatar asked Sep 18 '25 13:09

aprzybyła


1 Answers

In pom.xml

<project>
    ...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>1.2.1.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>

Source: Section Add a user before running the server of

https://docs.jboss.org/wildfly/plugins/maven/latest/examples/run-example.html

like image 156
Do Nhu Vy Avatar answered Sep 21 '25 04:09

Do Nhu Vy