Payara Server Tools in IntelliJ IDEA

This is only available in the Payara Platform Tools plugin which is exclusive to IntelliJ IDEA Ultimate

Using the Payara IntelliJ Tools plugin, you can integrate Payara Server within the IntelliJ IDEA and perform the following tasks:

  • Start and stop the Payara Server from within the IDE

  • Define the Java runtime to be used by Payara Server

  • Deploy an application from within the IDE

Managing Payara Server from the IntelliJ IDE

To manage Payara Server from the IntelliJ idea, first create the new Payara Server configuration by selecting the Edit Configuration option:

Create Configuration

In the Run/Debug Configurations dialog, click +, expand the Payara Server node, and select Local:

Create Local Server configuration

To add the Payara Server to the configuration, click the Configure…​ button and set it to the Payara Server’s installation path you would like to add to the IDE.

Specify the path to the JRE or JDK version you would like Payara Server to run on.

Finally, fix the debugger related warning by pressing the Fix button, which updates the debugger settings in the domains.xml of the selected Payara Server’s domain.

Complete run configuration

For now, ignore the No artifacts marked for deployment warning and click OK to save the configuration

Click the Run or Debug button from top-right panel to start Payara Server, or start Payara Server in debug mode, which would allow you to debug deployed applications

Start the Payara Server

You can see the server log in the Run > Payara Log window.

You can filter logs by level with the dropdown menu on the right of the Payara Log
Payara Server log

Deploying an Application to Payara Server from IntelliJ

To deploy an application to Payara Server you must further edit the run configuration you are using to run Payara Server from IntelliJ.

  1. Select the Run Configurations drop down menu

  2. Click on Edit Configurations

  3. Choose the Payara Server configuration to which you want to deploy the application.

  4. In the configuration settings, navigate to the Deployment section and click on the + button.

  5. Select Artifact…​ then choose the non-exploded format of your application’s name.

  6. Click OK

Add artifact

After application deployed to the Payara Server, IntelliJ starts a web browser and opens the application context root in the web browser.

Deploy Applications in a Local Docker Container

The Payara Server tools for IntelliJ IDEA include Docker integration, making it seamless to deploy exploded applications to a Payara Server instance running within a local Docker container.

  1. Run the Payara Server Docker container using the following command:

    docker run -p 8080:8080 -p 4848:4848 -p 9009:9009 -v HOST_PATH:CONTAINER_PATH  payara/server-full:{page-version}

    Replace HOST_PATH with the actual host path and CONTAINER_PATH with the desired container path that must be the exploded application path or parent path of application.

    The HOST_PATH points to the location on your host machine, and CONTAINER_PATH is the corresponding location inside the container.

  2. Open Intellij IDEA Ultimate and first create the new Payara Server configuration by selecting the Edit Configuration option:

  3. In the Run/Debug Configurations dialog, click +, expand the Payara Server node, and select Remote.

  4. To add the Payara Server to the configuration, click the Configure…​ button and set it to the Payara Server’s installation path with the same version as the one running in the Docker container.

  5. For Docker integration, choose the "Docker Volume" option and provide the HOST_PATH (e.g., D:/test) and CONTAINER_PATH (e.g., /mnt/test) mapping details.

    This mapping should align with the exploded application path or parent path of exploded application.

  6. Navigate to the Deployment section and click on the + button to select Artifact…​.

  7. Click OK

  8. Click the Run or Debug button from top-right panel to deploy the application to the registered Payara Server docker instance.

Deploy Applications in a WSL Environment

Another noteworthy feature is the integration of the Payara Server Tools with Windows Subsystem for Linux (WSL).

This integration empowers developers to manage and deploy exploded applications to a Payara Server instance running within WSL.

Here’s how you can make use of this feature:

  1. Start the Payara Server instance within WSL:

    1. Run the following command to start the server:

      ./asadmin start-domain
    2. Set a password for the admin user:

      ./asadmin change-admin-password
    3. Enable secure admin:

      ./asadmin enable-secure-admin
    4. Restart the Payara Server domain:

      ./asadmin restart-domain
  2. Register the WSL-based Payara Server instance in the IntelliJ IDEA:

    1. Open Intellij IDEA Ultimate and first create the new Payara Server configuration by selecting the Edit Configuration option:

    2. In the Run/Debug Configurations dialog, click +, expand the Payara Server node, and select Remote.

    3. To add the Payara Server to the configuration, click the Configure…​ button and set it to the Payara Server’s installation path running within WSL on your Windows machine.

    4. For WSL integration, choose the "WSL" option and make sure Use SSL Connection option is checked.

    5. Enter the host (fetched via the command hostname -I in WSL instance) and the necessary credentials.

    6. Navigate to the Deployment section and click on the + button to select Artifact…​.

    7. Click OK

    8. Click the Run or Debug button from top-right panel to deploy the application to the registered Payara Server WSL environment.