back to all blogsSee all blog posts

Open Liberty development mode

image of author
Eric Lau on Oct 22, 2019
Post available in languages:

Open Liberty development mode, or dev mode, allows you to develop applications with any text editor or IDE by providing hot reload and deployment, on demand testing, and debugger support. Your code is automatically compiled and deployed to your running server, making it easy to iterate on your changes. You can run tests on demand or even automatically so that you can get immediate feedback on your changes. You can also attach a debugger at any time to debug your running application.

For a quick demo of what you can do with dev mode, check out the following video:

You can also follow the steps in the demo-devmode project used in the above video to try it out yourself.

Setting up the project

For Maven projects, dev mode is run through the Liberty Maven Plugin. Specify the Liberty Maven Plugin with version 3.1 or above in your project’s pom.xml file.


Starting dev mode

Start dev mode by running the following command in your project: mvn liberty:dev

Automatically recompiling and deploying to the running server

Once dev mode is started, source code changes are automatically compiled and deployed to the running server. You can add new dependencies in your pom.xml file to be used for compilation. Resources and server configuration changes are also picked up. If any features are added to the server.xml file, they are installed automatically.

Running tests automatically and on demand

To run tests on demand, press Enter in the terminal where dev mode is running. This invokes the unit tests and integration tests that are configured for your project.

To run tests automatically after every change, include the -DhotTests parameter when starting dev mode. For example: mvn liberty:dev -DhotTests

Attaching a debugger

At any point during dev mode, you can attach a Java debugger to debug your application. By default, the debug port is 7777, but another port can be used and shown in the console output if the default port is not available.

Stopping dev mode

You can quit dev mode at any time by pressing CTRL+C in the terminal, or type q and press Enter.

Further reading

For more details on dev mode, see the documentation for the dev goal of the Liberty Maven Plugin.

You can also check out some of the guides to get started with using dev mode to develop an application: