In this tutorial, we will guide you through the process of integrating Maven, a powerful build automation tool, with WildFly, a robust and popular Java application server. By leveraging Maven’s dependency management and build capabilities, along with WildFly’s efficient deployment mechanism, you can streamline your development workflow and ensure smooth application deployment. Follow this comprehensive tutorial to master the integration of Maven and WildFly, enabling you to deliver high-quality Java applications effortlessly.
Step 1: Set up a basic Maven project
Firstly, you need a Maven project which is able to build a Web application ( or alternatively a JAR or EAR Archive). There are several available Maven archetypes, however for modern application we recommend using the Jakarta EE Maven quickstart: https://start.jakarta.ee/
Select the Jakarta EE version, the Java version and the Runtime, for example WildFly application Server:

Step 2: Import the Maven Project in your IDE
Next step is to import the Maven project into your favourite IDE. All modern IDEs are able to identify a Maven project, therefore it is sufficient to Import or Open the Project root directory:

The Jakarta EE quickstart contains an example REST Resource:
@Path("hello") public class HelloWorldResource { @GET @Produces({ MediaType.APPLICATION_JSON }) public Hello hello(@QueryParam("name") String name) { if ((name == null) || name.trim().isEmpty()) { name = "world"; } return new Hello(name); } }
In the next part of this tutorial, we will see how to build, deploy and test this simple REST Endpoint.
Step 3: Build and Test the Maven project
Our basic project includes the WildFly Maven plugin which simplifies the installation and deployment of the Maven project on WildFly:
<plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>${wildfly-plugin.version}</version> <configuration> <version>${wildfly.version}</version> <server-config>standalone-full.xml</server-config> </configuration> </plugin>
Before deploying the application, start WildFly application server:
$ ./standalone.sh
Finally, you can deploy the Maven project on WildFly with:
mvn install wildfly:deploy
Now you can access the application at: http://localhost:8080/jakartaee-hello-world/rest/hello

You can further improve your productivity by enhancing the configuration of your WildFly Maven plugin. Take a look at this article to learn more: How to configure and run Maven WildFly plugin
Conclusion
In conclusion, integrating Maven with WildFly empowers developers to streamline their Java application development and deployment process. By leveraging Maven’s dependency management and build automation capabilities, combined with the robustness and efficiency of WildFly, developers can ensure seamless deployment and efficient management of their applications.
With this step-by-step tutorial, we have guided you through the process of setting up WildFly, configuring Maven, creating a Maven project, defining dependencies, building the project, and deploying it to WildFly. By following these steps, you have learned how to harness the power of Maven and leverage the capabilities of WildFly for smooth and hassle-free application deployment.