Open Liberty dev mode with VS Code
The Liberty Dev VS Code extension lets you start Open Liberty in development mode, make changes to your application while the server is up, run tests and view results, and even debug the application without leaving the editor.
We’ve shown how Open Liberty dev mode can be run from a command line while allowing you to edit your code with any text editor or IDE. In this blog post, you’ll see how the optional extension for VS Code makes it even easier to interact with dev mode for a more seamless experience.
For a demo of the extension, check out the following video:
Installing the extension
Setting up the project
For Maven projects, dev mode requires the Liberty Maven Plugin. Specify the Liberty Maven Plugin with version 3.1
or above in your project’s pom.xml
file.
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.1</version>
</plugin>
Interacting with dev mode
Once the Liberty Maven Plugin is specified in your pom.xml
file, your project name is then listed under the Liberty Dev Dashboard in the side panel. You can interact with dev mode by right-clicking on your project name and selecting one of the commands.
Commands
The following commands can be selected from the drop-down menu after right-clicking on your project name in the Liberty Dev Dashboard.
Command | Description |
---|---|
Run tests |
Runs the unit tests and integration tests that are configured for your project. This command requires dev mode to be already started. |
Start |
Starts dev mode. |
Start… |
Starts dev mode with custom parameters. For example, to run tests automatically after every change, include the |
Stop |
Stops dev mode. |
View integration test report |
Views the integration test report file. |
View unit test report |
Views the unit test report file. |
What you can do with dev mode
Dev mode allows you as the developer to focus on your code. When Open Liberty is running in dev mode, your code is automatically compiled and deployed to the 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. The video above shows examples of how these can be done within VS Code with the Liberty Dev extension.
For more information, see our previous blog post on dev mode or refer to the documentation for the dev goal of the Liberty Maven Plugin.