Skip to content

Latest commit

 

History

History
92 lines (64 loc) · 3.17 KB

getstarted.adoc

File metadata and controls

92 lines (64 loc) · 3.17 KB
layout title permalink
getstarted
Getting Started with WildFly
/get-started/

Build and run a Jakarta EE application with WildFly in a few minutes.

Step 0. Install Java & Maven

You need Java (at least version 11, and preferably 17) and Maven installed on your machine to create a Maven project that contains the source code of the Jakarta EE application.

You can verify they are installed by executing the commands:

java -version
mvn -version

Step 1. Create the Application

You can create the Jakarta EE application as a Maven project by executing the commands:

mvn archetype:generate \
    -DarchetypeGroupId=org.wildfly.archetype \
    -DarchetypeArtifactId=wildfly-getting-started-archetype

The getting-started project that is generated contains a simple "Hello World" application that exposes a HTTP endpoint with the Jakarta-RS API.

The Maven project is configured to "provision" (install and configure) the WildFly that hosts your application.

Step 2. Build the Application

You can build the application by executing the commands:

cd getting-started
mvn package verify

This Maven command compiles the Jakarta EE application, provisions WildFly, deploys the application into WildFly and runs integration tests against it. When this command is finished, you have a fully functional, tested application running on WildFly.

Step 3. Run the Application

The target/server contains a fully functional WildFly server with your application. You start it by executing the command:

./target/server/bin/standalone.sh

The application is accessible at http://localhost:8080/.

To stop the application, type Ctrl + C in the terminal where you started WildFly.

Step 4. Continuous Development

You can develop your application and see the updates in the running application immediately by using the wildfly:dev goal from the root of your project:

mvn clean wildfly:dev

The application is accessible at http://localhost:8080 and will be continuously updated when its code changes.

Open your favorite code editor and change the hello method in the GettingStartedService.java file:

public String hello(String name) {
  return String.format("Hello '%s'.", name.toUpperCase());
}

Save the file and the application will be recompiled and updated in WildFly. If you access the application at http://localhost:8080, it will now return the name in upper case.

What’s next?

To learn more about WildFly, you can read its documentation. If you want to learn how to use WildFly on OpenShift, read the https://docs.wildfly.org/{{ site.data.releases | where:"qualifier", "Final" | map: "version" | first | split: "." | first }}/Getting_Started_on_OpenShift.html[Getting Started with WildFly on OpenShift Guide,window=_blank]. In addition, you can also watch the talk from our first mini conference about getting started with WildFly. Finally you can browse more guides on a wide range of topics relating to WildFly.