Create a Jakarta EE 8 Web Application with Payara Server and Visual Studio Code
Originally published on 01 May 2021
Last updated on 22 Jun 2021
In this blog, we show you how to start your next Jakarta EE application with Visual Studio Code using the plugin for the Payara Server.
We will create a Maven project so that you can also build it outside the IDE, such as in your CI environment, so you can automate your deployments.
Payara Tools in Visual Studio Code
We have created a specific plugin for Payara products that can be used with the IDE. It requires the Java plugin, but that is a plugin you probably already have and can be added by clicking on the Extensions icon on the left-sidebar or through the key combination Control + Shift + X or Command + Shift + X on Mac
Once the plugin is added to the IDE, you can configure the Payara Server from the plugin so you can run the application directly from within the IDE.
Select the Payara Servers plugin area and click on the + icon. The wizards lead you via a few questions to the correct step. You can specify a name, the location where the Payara Server is installed, and which domain you want to use.
We are now ready to create our Jakarta EE project.
Start New Project
You can create a new Maven project directly from within the IDE. You need to select a Maven Archetype to create this project. There are several archetypes available for Jakarta EE 8 with more or less functionality provided by the template. One of the archetypes that you can choose to get started with Jakarta EE is this one: https://github.com/khasunuma/jakartaee-quickstart-archetype
To create a project, you can click on the 'Create Java Project' when you don't have any projects open, or you can select the Maven action with the key Combination Control + Shift + P or Command + Shift + P on Mac.
Or using the Control + Shift + P or Command + Shift + P key combination.
Place the jakartaee-quickstart-archetype text in the field to find the archetype to use. You will need to click 'More ...' to search in the remote catalog of Maven.
Run Application
The jakartaee-quickstart-archetype maven archetype has created a simple REST endpoint and a JSF application that retrieved a value from a managed bean. It contains the ideal starter for the typical Jakarta EE project as they are two of the most important technologies in the framework.
You can immediately try this application out or you can start implementing your functionality in the application. When you want to deploy the application on the Payara Server, right-click on one of the resource files and select the 'Run on Payara Server' menu item.
The Payara Server that you configured earlier will start up and run your application. You can interact with it like you normally do with any other application, for example, through the browser.
Conclusion
Visual Studio Code relies on the Maven Archetype you specify to create a Maven project that is immediately imported into the IDE itself. There are several archetypes available on Maven central, each having some additional initial code. We used the one that only contains a Jakarta EE 8 example for Jakarta REST and Jakarta Faces. But there are others available and some include the MicroProfile dependencies that are also supported by Payara Server.
Once the project is created, you can run it on the Payara Server you have configured and can be used through the plugin we have created.
Related Posts
The Payara Monthly Catch - October 2024
Published on 30 Oct 2024
by Chiara Civardi
0 Comments
The Payara Monthly Catch - September 2024
Published on 30 Sep 2024
by Chiara Civardi
0 Comments