In this blog, we show you how to start your next Jakarta EE application using the Payara Server plugin on the Eclipse IDE.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 Eclipse IDE
To get started, make sure you have the Eclipse Plugin for the Payara Server installed within your IDE. If you don't have it, you can go to the marketplace and select the Payara Tools plugin.
Once you have confirmed the different steps of the wizard, you can configure the plugin to use the Payara Server installation on your machine. On the Server window of the IDE, click on the New item to get the dialog for adding Payara Server.
With the Add link behind the Server runtime environment, you can select the directory where the Payara Server is installed and the JDK that needs to be used when you run your application later on.
For more information on the plugin, have a look at our documentation page.
Start New Project
Now that the IDE environment is ready, we can create the Jakarta EE 8 project. From the menu File --> New --> project item, you get a list of all the projects that you can create. Select the Maven project item at this stage.
In the next screen of the wizard, you need to indicate the location where the project will be created. Eclipse has no default Maven project that will be created, but you can select any Maven archetype for this purpose. One of the archetypes that you can choose to get started with Jakarta EE is this one: https://github.com/khasunuma/jakartaee-quickstart-archetype
Within the wizard, you can find the archetype by putting jakartaee-quickstart-archetype in the filter field.
When the wizard finishes, the archetype is executed and the project is created in the indicated directory.
When the Maven project is imported into the Eclipse IDE, it should receive the Dynamic Web Project facet. To be sure, check out the selected facets through the properties menu of the project. At the same time, you can also select the Payara Web Extensions facet so you have some Payara-specific functionality available within the project.
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, choose Run As -> Run on server menu item and select the Payara Server setup we have created earlier. On the next screen of the wizard, the web application will be on the right side, indicating it will be deployed. You can deploy multiple applications at the same time or have a look at the applications that are deployed already.
When the application is deployed and running, you can use either the internal Web browser of the Eclipse IDE or the browser of your choice, so you can call the REST endpoint in the application, for example.
Create and Run a Jakarta EE 8 Web Application with Eclipse IDE and the Payara Tools Plugin
Eclipse IDE 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 already include the MicroProfile dependencies that are also supported by Payara Server.
Once the project is created, you can run it on Payara Server using the plugin. The plugin allows you to start and stop the application, and also lets you look at the logging and the domain configuration file.