Payara Micro tools in IntelliJ

Creating new Payara Micro Maven Application

  • Simply start up IntelliJ IDEA and then Choose File > New > Project from the main menu and select the Payara Micro project type:

Generate Payara Micro Application
  • Enter the groupId, artifactId, etc to set up the project, and then click Next:

Enter GAV
  • On the Project name and Location panel, enter sample-micro-app as the project name, set the Project destination folder and click Finish:

Enter Project name
  • When you click Finish, the IDE creates the following projects from the Payara Micro maven archetype:

Generating Micro project
  • Once the project is generated, you may either add the project to the current workspace or open in a new window:

Generated Micro project
  • As you can see, the project has a basic structure with src\main\java and src\main\webapp folders:

Project source tree

Payara Micro application can be managed via IntelliJ Run/Debug configuration or Actions, where Run configuration can be customized by the developer and Actions are quick & easy to use:

Run the Payara Micro Application via configuration:

IntelliJ IDEA needs a run configuration to build the artifacts and run the Payara Micro application.

  • From the main menu, select Run | Edit Configurations:

Create Config
  • In the Run/Debug Configurations dialog, click +, expand the Payara Micro node, and select Maven:

Create Micro Maven Config
  • Now add the Before launch tasks and assign a new artifact, click + on the left-hand pane, choose the Build Artifacts type from the drop-down list:

Build artifact
  • In the Select Artifacts dialog, select to build the sample-micro-app:war artifact:

Choose artifact
  • Now save the configuration:

Save Configuration
  • To start the Payara Micro instance, click the run button in the top-right panel:

Run Configuration
  • After running the Micro application, you may see the log in the OUTPUT window:

Payara Micro log

Debugging the Payara Micro Application

  • Instead of pressing the Run button, you can instead click Debug from similar locations to automatically start the micro instance and attach the debugger to the application:

Debug Configuration
  • After debugging the Payara Micro application, you may see the log in the Debug > Console window:

Payara Micro debug log
  • After the debugger session starts and the application hits the breakpoint, the line where the servlet paused gets highlighted and the Debug tool window appears with the list of running threads and the stack-trace:

Payara Micro debug breakpoint hit

Run the Payara Micro Application via actions:

The Payara IntelliJ tools also provide inbuilt actions to manage the Payara Micro application without creating the project configuration, which internally executes Payara Micro Maven/Gradle plugin goals/tasks:

  • To invoke the actions, Goto Help > Find Action..:

Find Actions
  • Search the Micro actions and press the enter key:

Run Micro
Micro logs
  • Similarly, you may also debug the Payara Micro application via actions:

Debug Micro
Debug logs