Streamlining Payara Micro Development with Dev Mode

Payara
No Image

Introduction

Payara Micro, a lightweight and flexible microservices runtime platform, offers a seamless development experience through its Maven plugin. In this guide, we’ll explore the Dev Mode of Payara Micro Maven plugin, focusing on the dev goal. This goal is tailored to streamline development by enabling various features for an efficient workflow.

Features in Dev Mode

  1. Auto Deploy: Your application is automatically compiled and deployed upon saving files.
  • Eliminates Manual Steps: No more manual builds, packaging and redeployment required after every change.
  • Focus on Code: This lets developers stay directly engaged with the code and the results of their changes without workflow interruptions.
  • Rapid Iteration: Smaller feedback loop accelerates development and testing cycles.
  1. Live Reload:  The browser refreshes automatically upon redeployment.
  • Instant Feedback: Changes are immediately visualized in the browser, providing near real-time feedback.
  • Seamless UI Tweaking: Especially beneficial for front-end development, like JSF. No more manual refreshes needed.
  • Integrated Experience: Pairs perfectly with auto-deploy for seeing the effects of your code modifications almost instantly.
  1. Persistent Session State: Session state is persisted across multiple re-deployments.
  • Preserves Context: Avoids losing user-related data (e.g., shopping cart contents, login information) during development when the application redeploys.
  • Realistic Testing: Emulates production-like user journeys through your application without disruptions caused by redeployments.
  • Debugging: Helps isolate issues that might be influenced by session state or user flow across multiple steps.
  1. Readable Logging: Log format is enhanced for improved readability
  • Faster Troubleshooting: Well-formatted logs with clear timestamps and structure make it easier to parse and find relevant information when debugging.
  • Less Cognitive Load: Easier-to-read logs reduce the mental effort required to decipher complex issues.
  • Customization: Some dev modes might allow further customization of log formatting to match individual developer preferences.

Combined, these Dev Mode features foster:

    • Productivity: Developers spend less time on repetitive tasks and more time coding.
    • Quality: Instant feedback and context preservation can lead to catching bugs and UI inconsistencies earlier in the development process.
    • Developer Satisfaction: A smoother workflow and less frustration contribute to a more enjoyable development experience.

Getting Started with Payara Starter

  1. Open Payara Starter: Navigate to Payara Starter.
  2. Project Configuration:
    • Select “Maven Project” as the project type under the Project Details section.
    • Choose “Jakarta EE 10” as the Jakarta EE version.
    • Set “Payara Micro” as the Payara Platform.
  3. Generate Application: Click on the “Generate” or “Download” button to generate your Payara Micro Maven project.
  4. Extract the Application: After downloading, extract the generated application to a location of your choice.

Building and Running the Application via Commandline

Now that you have your Payara Micro Maven project, follow these steps to build and run it using the mvn package payara-micro:dev command:

  1. Open a terminal or command prompt.
  2. Navigate to the directory where you extracted the generated Payara Micro Maven project.
  3. Build the Application: Run the following Maven command to build the application and create the necessary artifacts: mvn package payara-micro:dev
  4. Watch the Magic Happen: The dev goal initiates Payara Micro in development mode, enabling features such as auto deploy, live reload, and more.
  5. Monitor the Console: Payara Micro will start and you’ll see relevant logs in the console.
  6. Access the Application: Once Payara Micro is up and running, the application home page will be automatically opened in the browser.
  7. Test Live Reload: Navigate through the application from the home page to your preferred page. Open the source code in your IDE, make updates, and save it.
  8. Incremental Compilation: The Dev Mode running in the background will start incrementally compiling the changed source code.
  9. Background Deployment: The application will be deployed in the background, and the browser page will be refreshed automatically.
Animation

Building and Running the Application in IntelliJ

IntelliJ IDEA provides a powerful integrated development environment for Java developers. Here’s how you can configure and run your Jakarta EE Web project in IntelliJ:


  1. Open IntelliJ IDEA: Launch IntelliJ IDEA and open your Jakarta EE Maven Web project.



  2. Configure Payara Micro: Navigate to “Edit Configurations” from the top-right corner dropdown menu or by selecting “Run” > “Edit Configurations” from the menu bar.


  3. Add Payara Micro Configuration: Click on the “+” icon and select “Maven” from the dropdown. In the configuration settings, specify the following:


    1. Name: Provide a name for your configuration (e.g., Payara Micro Dev).



    2. Command line: Enter the Maven command to run Payara Micro in dev mode. For Payara Micro Maven plugin upgrade version to 2.2 and use dev goal, use the following command: package fish.payara.maven.plugins:payara-micro-maven-plugin:2.2:dev



    3. Working directory: Set the path to your Payara Micro Maven project directory.


4. Apply Configuration: Click “Apply” to save the configuration settings.

5. Run the Project: Now, simply build and click on the green “Run” icon or select “Run” > “Run ‘Payara Micro Dev'” from the menu bar.

6. Development Mode: IntelliJ will start the project in dev mode using Payara Micro. Any changes made to the source code will trigger auto deployment and live reload.

By following these steps, you can seamlessly build, run, and develop your Payara Micro Maven project in IntelliJ IDEA, leveraging the efficient features provided by the Payara Micro Maven plugin.

Conclusions

Integrating Payara Micro into your Maven projects becomes a breeze with the Payara Micro Maven Plugin. The dev goal, designed for productive development, enhances your workflow with features such as auto-deploy, live-reload and more. For detailed information and comprehensive documentation on the Payara Micro Maven Plugin, please refer to the official Payara documentation: Payara Micro Maven Plugin Documentation, download your Jakarta EE starter here and get productive. Happy Coding!

Branding Tagline_Hubspot Banner-1

 

Comments (3)

Post a comment

Your email address will not be published. Required fields are marked *

Payara needs the contact information you provide to us to contact you about our products and services. You may unsubscribe from these communications at any time. For information on how to unsubscribe, as well as our privacy practices and commitment to protecting your privacy, please review our Legal & Privacy Policy.

  1. Juan Bertinetti

    It would be nice to have these features for Gradle projects alongside Maven.

  2. Kennedy Mbogo

    Can I deploy a jakarta faces app using payara micro?

    1. Luqman Saeed

      Yes. Payara Micro supports the Jakarta EE Web Profile Standard. As such, you can deploy your Jakarta Faces web application on it.

Related Posts

payara qube logo 5 minutes
Payara

Payara Cloud Is Now part of Payara Qube family of Unified Platforms for Enterprise Java

Payara Cloud is becoming part of Payara Qube family of Java application deployment runtimes. This move reflects how the […]

Payara promotional graphic showing transition from Spring to Jakarta EE, including technology logos, a code icon and arrows leading from Spring to Jakarta EE. 6 minutes
Jakarta EE

From Spring Boot To Jakarta EE 11: How Payara Starter Eases The Transition

If you’ve been living in the Spring ecosystem, you’re used to fast project setup. Spring Initializr gives you a […]

Promotional graphic for a podcast episode titled “Why Open Source is the Future of Business Innovation - A conversation with Arun Gupta”. The podcast is hosted by Payara Community. The right side features a photo of the speaker, Arun Gupta, labeled as a “VP, Developer Experience at JetBrains”. The design uses dark blue and teal backgrounds with coral and fish illustrations. 2 minutes
Community

Payara Podcast – Why Open Source is the Future of Business Innovation – A Conversation with Arun Gupta

Open source is no longer a developer-only concern — it’s at the heart of how modern businesses innovate, build […]