Using the Payara Tools, you can integrate Payara Server within the IntelliJ IDEA to streamline development workflows. This integration allows you to:
-
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: image::intellij-plugin/payara-server/create-configuration.png[Create Configuration]
-
In the Run/Debug Configurations dialog, click +, select the Payara Server: image::intellij-plugin/payara-server/create-server-configuration.png[Create Server configuration]
-
In the newly created configuration:
-
Set the goal to
dev
to deploy the application in development mode orstart
to start the server without dev mode. -
Specify the JDK or JRE path that Payara Server should use.
-
-
Optionally, configure the application’s context path or exploded format. image::intellij-plugin/payara-server/app-configuration.png[App configuration]
-
To add the Payara Server to the configuration, click the Payara Server Settings > Payara Home and set it to the Payara Server’s installation path you would like to add to the IDE. image::intellij-plugin/payara-server/payara-configuration.png[Payara configuration]
-
Configure environment variables and system properties for the server. image::intellij-plugin/payara-server/env-server-properties.png[Env and Server properties]
-
Define Maven properties used during the build. image::intellij-plugin/payara-server/maven-properties.png[Maven properties]
-
Specify Maven tasks to run before launching the server. image::intellij-plugin/payara-server/before-launch-task.png[Before Launch Task]
-
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 image::intellij-plugin/payara-server/run-server.png[Start the Payara Server]
-
You can see the server log in the application build console window. image::intellij-plugin/payara-server/server-log.png[Payara Server log]
-
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.
-
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 andCONTAINER_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, andCONTAINER_PATH
is the corresponding location inside the container. -
Open Intellij IDEA Ultimate and first create the new Payara Server configuration by selecting the Edit Configuration option:
-
In the Run/Debug Configurations dialog, click
+
, expand the Payara Server node, and select Remote. -
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.
-
For Docker integration, choose the "Docker Volume" option and provide the
HOST_PATH
(e.g.,D:/test
) andCONTAINER_PATH
(e.g.,/mnt/test
) mapping details.This mapping should align with the exploded application path or parent path of exploded application.
-
Navigate to the Deployment section and click on the
+
button to select Artifact…. -
Click OK
-
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:
-
Start the Payara Server instance within WSL:
-
Run the following command to start the server:
./asadmin start-domain
-
Set a password for the admin user:
./asadmin change-admin-password
-
Enable secure admin:
./asadmin enable-secure-admin
-
Restart the Payara Server domain:
./asadmin restart-domain
-
-
Register the WSL-based Payara Server instance in the IntelliJ IDEA:
-
Open Intellij IDEA Ultimate and first create the new Payara Server configuration by selecting the Edit Configuration option:
-
In the Run/Debug Configurations dialog, click
+
, select the Payara Server node then go to Payara Server Settings and check the checkbox Remote. -
To add the Payara Server to the configuration, click the browse button in Payara Home field and set it to the Payara Server’s installation path running within WSL on your Windows machine.
-
For WSL integration, choose the "WSL" option and make sure Use SSL Connection option is checked.
-
Enter the host (fetched via the command
hostname -I
in WSL instance) and the necessary credentials. -
Click OK
-
Click the Run or Debug button from top-right panel to deploy the application to the registered Payara Server WSL environment.
-