Improved Java EE and Jakarta EE productivity with WAD

Last Updated:  May 8, 2020 | Published: February 28, 2019

The productivity of your developers is crucial for the success of your project. Without fast deployments and short feedback-cycles about a new feature, you lose a lot of time just “idling”. As a Java/Jakarta EE developer, you will most likely have a local installation for the target application server and deploy the application several times a day during development. In the past, I've used Eclipse/IntelliJ/Netbeans with various vendor plugins to start the application server and deploy on every new code change. This was always quite a fiddling task, as I sometimes got issues with the plugins, had to wait for a new release or it wasn't as fast as I expected until I could see my changes. Luckily Adam Bien (@AdamBien) solved this with a small Java project called WAD (Watch and Deploy) which deploys thin .war ‘s on every change to any server and improves your productivity.

In this blog post, I'll review the project and show you my personal setup.

Prerequisites

First, make sure you have Maven installed on your machine and that the bin folder of Maven is on your PATH. In addition, you have to set the MAVEN_HOME environment variable for Linux/Mac and M2_HOME for Windows to the path of the Maven root folder e.g. C:\Users\rieckpil\development\maven-3.5.3

Getting started

To start with WAD you first have to download the .jar file from GitHub and place it into your Java EE or Jakarta EE project folder next to your pom.xml (for quick Java EE 8 application bootstrapping, have a look at my or Adam's Maven archetype).  With the .jar file in place, you can now start it with:

WAD will now watch for changes within src/main . On every change, the project is built and deployed to the folder you specified during the launch of WADYou can manually specify application server auto-deployment folders (e.g. for Payara: .../Payara/glassfish/domains/domain1/autodeploy) separated by spaces or use a global configuration as described in the following section.

With the latest release of WAD, you can even configure the deployment folders in one place with a .wadrc located in your home/user directory. This file specifies all deployment folders separated by a new line like:

With this setup, you can now launch WADwithout an additional parameter like:

and it will detect all deployment folders automatically:

During the first launch, your project is initially built and deployed:

You can now start the application server of your choice or start all in parallel (when running TomEE/Payara/WildFly in parallel make sure they all start on a different port and not all on 8080) and test your application against every vendor if you want to.

In addition, I personally launch a tail -f server.log (on Windows I use either Git Bash or MobaXterm for that) for the application server, I'm using to see possible errors within the console. Furthermore, I defined aliases to start and run every application server on my machine:

Final thoughts

With this tooling, you can now pick any Editor (Visual Code, Atom, Notepad++ ...) or IDE of your choice and start coding. When you save your changes they will be automatically deployed and you can see the results after a short delay (1 – 3 seconds, depending on how thin your .war is) in your browser.

If you are looking for a Docker-based solution in combination with WAD, have a look at this excellent video of Sebastian Daschner.

For new releases of WAD have a look at the official homepage wad.sh or at GitHub.

You can find a quick example of using WAD in my GitHub repository.

Happy Java EE hacking,

Phil

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join Our Mailing List To Get 3x Free Cheat Sheets

Free Java Cheat Sheets
>