Introduction
Helidon is a collection of libraries for writing microservices. It fully supports GraalVM, Jakarta EE, and Microprofile. While the quickstart on the Helidon site already tells you how to create a project, I wanted to offer you a few great alternatives.
This tutorial will look at creating a Helidon project using the online starter and IntelliJ. I will also cover how to create a run profile for your project, so you don't have to use the command line every time.
Using the online starter
My favorite place on the internet… as some advocates would say. The easiest way to start with Helidon is to create your project with the starter. The starter will help you set most, if not all, the dependencies you need to create a modern REST application. The starter is available here at https://helidon.io/starter/
One tip before you start creating your project! Selecting the Custom Application type gives you many more options to create a modern application. You can set things like the JPA implementation, DB server, media support, metrics, tracing, and more!
This tool makes creating a Helidon project easy; I prefer this starter to the one Spring has for Spring projects.
IntelliJ plugin
If you want to start developing your Helidon even faster, you can use the IntelliJ plugin. With the plugin installed, you get a new option in IntelliJ when creating a new project.
Installing the plugin is done with just a few steps if you use IntelliJ:
- Go to File in the top left corner
- Select Settings…
- Click on plugins
- Search for Helidon
- Click on install
After these steps, the plugin will be installed, and creating a Helidon project will be a breeze.
With the plugin, you can create a new project using the New Project feature of IntelliJ.
With the plugin, you will see a new generator on the left of the window inside the list. This will create a Helidon project and create a run config for the application in IntelliJ.
Running any Helidon project in IntelliJ
You can import any Helidon project, edit files in your IDE, and start the project by running the following two commands:
|
|
While this is easy enough, it can become quite tedious. With IntelliJ, you can also create a run profile to start the application. All you need to do is to create a new run configuration. The project's run configuration is in the upper right corner next to the green play icon.
When you see the run configuration screen like the following, perform these steps:
- Click on the plus sign
- Select Application
- Set the main class set to
io.helidon.microprofile.cdi.Main
- Click Ok
The run configuration is now ready! You can now use the play icon to start and control an instance of your Helidon application.
Setting the project up yourself
This tutorial is focused on using an IDE(IntelliJ) to create and run Helidon projects. If you want to create a project from scratch without the starter take a look at these resources:
These resources are a great starting point for creating applications using Helidon.
Conclusion
In this tutorial, we looked at how to create a Helidon project using the starter. You learned that the starter sets up a lot of the dependencies you will probably use. You also learned that a plugin-in exists to create a Helidon Project in IntelliJ. Last but not least, you learned how to create a run configuration for your IDE.
Further reading
If you want to know about this topic, take a look at the following resources: