Effective cloud native development with Open Liberty in Visual Studio Code
Liberty Tools for Visual Studio Code enables fast, easy and efficient development of cloud native Java applications with Open Liberty, a lightweight, open framework
Open Liberty is a lightweight, open framework, great for building fast and efficient cloud-native Java applications. However, choosing an effective cloud-native Java runtime for your application (alone) doesn’t always directly equate to efficient creation of cloud-native applications. As developers, it’s important we use these runtimes and supporting tools effectively to enable an efficient development cycle and ensure productivity within our development teams.
As cloud-native developers, you have to care not only about developing your application, but also the building, deployment, and management of it in production. These added tasks create a complex and often challenging environment, which causes you to be constantly switching between different platforms, tools, and frameworks.
What you need is a way in which you could complete this diverse set of tasks, with language and framework support, all within one IDE. The open source Liberty Tools for Visual Studio Code, offers just this option, helping you in developing, building, testing, deploying, and managing your applications – all within your favorite IDE, Visual Studio Code!
Liberty Tools is a set of intuitive developer tools that provide a simplified yet powerful development experience. They support popular integrated development environments (IDEs) including Visual Studio Code, available as an extension.
Key Capabilities of Liberty Tools
These tools introduce capabilities that really empower you to develop, test, debug, and manage applications without having to leave your IDE, including:
Easily view and access all detected Liberty projects in your IDE in the Liberty Dashboard
Rapid, iterative development with Liberty dev mode
Effective testing and debugging all within the IDE
Editing assistance for you to easily make changes to their configuration files
Coding assistance for you to write applications that use Jakarta EE (9.x and later) and MicroProfile (3.x and later) APIs, including validations, quick fixes, and completions
In this article, we’ll dive further into these capabilities. If you want to view a deep dive tutorial on this tool, then watch the Developer Deep Dive of Liberty Tools for Visual Studio Code video. Clips of this video are used in this article to showcase these capabilities.
View and access all detected Liberty projects in your IDE in the Liberty Dashboard
Liberty Tools automatically detects Liberty Maven or Gradle projects. These projects are added to a special Liberty dashboard view in Visual Studio Code. From this dashboard, you can access a command menu to manage your projects. Now, you don’t have to spend time creating and managing Liberty instances, which frees up your time to focus on the code itself.
Rapid, iterative development with Liberty dev mode
Liberty dev mode automatically detects, recompiles, and deploys code changes whenever you save a new change. It also runs unit and integration tests on demand and can attach a debugger to the running server to step through your code at any time. Liberty Tools brings these dev mode features directly into the command menu for the Liberty projects in your editor. With just a few clicks, you can start and stop your Liberty application, run tests, and view test reports.
Liberty dev mode enables rapid, iterative development in a manner that aligns with agile development practices that are recommended for cloud-native applications. See how you can get started rapidly with dev mode using Liberty Tools in the following video. To try this for yourself, follow the steps in the Liberty Tools user guide to run your app on Liberty using dev mode.
Video will open in new tab or window.
You can also run your application in dev mode in a container. When dev mode runs with container support, it builds a container image and runs the container. For more information on dev mode for containers, check out the Liberty Maven devc goal or the Liberty Gradle libertyDevc task.
Effective testing and debugging within the IDE
When your application is running on Liberty using dev mode, you can easily run the tests provided by your application. To do the tests, select the Run tests command in the Liberty dashboard. You can also configure Liberty to automatically re-run tests after you’ve made changes. After the application tests finish running, you can access the test reports that were generated. The reports vary depending on what build tool you have used.
You can also attach a debugger to a running Liberty instance using the "Attach debugger" command in the Liberty Dashboard, which makes the standard Visual Studio Code debug options available. The following video shows how this can be achieved with just a few clicks with Liberty Tools in your VS Code IDE. For more on this, you can see the steps required in the Liberty Tools user guide section: debug your application.
To use Liberty-specific code completion, press Ctrl + Space or Cmd + Space anywhere in the document and a drop-down list of completion suggestions will appear. To see an example of what this editing assistance is like, check out the following video, or try following the steps in the Liberty Tools user guide for configuring a Liberty server with configuration assistance.
Video will open in new tab or window.
Coding assistance for Jakarta EE and MicroProfile APIs
Liberty Tools coding assistance also provide helpful language-support features such as code completion, diagnostics, and quick-fixes in configuration and application files for Jakarta EE and MicroProfile APIs.
The Jakarta EE API coding assistance is offered through Eclipse LSP4Jakarta, the Language Server for Jakarta EE. The following video showcases some of the functionality enabled through the LSP4Jakarta project which is included as part of Liberty Tools.
Video will open in new tab or window.
The MicroProfile EE API coding assistance is offered through Eclipse LSP4MP, the Language Server for MicroProfile. The following video showcases similar coding assistance features but specifically for MicroProfile.
Liberty Maven plugin or Liberty Gradle plugin configured in the pom.xml or build.gradle file for your app. Use the most recent version of the plugin to get important bug fixes.
When installed, the Liberty dashboard displays in the Project Explorer. Projects that are already properly configured to run on Liberty and use Liberty dev mode are automatically added to the Liberty dashboard when it opens.
Projects that are already properly configured to run on Liberty and use Liberty dev mode are automatically added to the Liberty dashboard when it opens.
Summary and next steps
With the Liberty Tools extension in Visual Studio Code, you can efficiently develop, deploy, debug, test, and manage your cloud-native Java applications.
About cookies on this siteOur websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising.For more information, please review your cookie preferences options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.