Fetching and compiling the Wildfly upstream source

May 5, 2017
• Weinan

In this article I want to teach you how to fetch the Wildfly code from Github and compile it for playing. First we need to clone the Wildfly source repository from Github, and here is the address of the repository:

The above output shows the directory structure of the wildfly project. We can see the project is organized in subsystems. For example, the undertow subsystem is the WebServer module of the Wildfly, and jaxrs is the RESTFul WebService module. We will check these subsystems in future. The whole project is Maven based, and there is a build script named build.sh in the root directory. We can run the build script locally to build the whole project. Here is the command and part of the output:

From the above command and its output we can see the build.sh will start to build the project using the mvnw command. The mvnw command will install Maven into local folder firstly, and then use it to build the project. The time to build the whole project depends on the speed of your network and the configuration of your hardware. During the build process, it will download many components from online Maven repositories, and it will run many tests in project. During the first time of build, it will use most time to download the dependencies, and the future builds will use less time. Here is the output of my build in my local machine:

Above is a summary of the built components in wildfly. After all the components are built, it will be assembled into a runnable application server. You can find it in the build/target directory of the project. Here are the contents of the directory:

From above, we can see the application server is in wildfly-11.0.0.Beta1-SNAPSHOT, and there is also a zipped pacakge for distribution. We can enter the wildfly-11.0.0.Beta1-SNAPSHOT directory and check its contents:

The above output shows the server has been started. Until now, we have fetched the Wildfly source from Github repository, and we have built it locally in our machine, and then we run the application server locally. This is the basis to play with Wildfly source code. In future, we just need to keep pulling the newest code of Wildfly from the Github and compile it, then we can keep running a newest Wildfly server for study.