Preview the new way to start coding with Quarkus

Have you ever generated a Quarkus project using the Maven plugin or code.quarkus.io?

If you did, then you might have wondered why, with the breadth of Quarkus extensions, we would only let you generate a REST API example application. Of course, you can pick extensions which are going to be in the dependencies of your app, this is pretty cool because some extensions are providing new features without any extra code. However, some extensions also require configuration and/or code to work, making it pretty limited as it is.

Introducing our new code generation system

This is why we are thrilled to introduce the preview of our new code generation system in Quarkus 1.7.0.Final. It is called Codestarts. The idea is simple, you pick your extensions and they are able to provide example code to get you started.

This preview version is just the beginning and includes three example codestarts:

  • The legendary RESTEasy example in Java, Kotlin and Scala, when you pick the RESTEasy extension

  • The lovely and sweet template engine Qute in Java, when you pick the Qute extension

  • The tough and strong Quarkus Command Mode in Java, when you don’t pick any extension that provides an example

Wanna give it a try?

We added a feature flag in the Quarkus Maven plugin to create your application:

mvn io.quarkus:quarkus-maven-plugin:create -DcodestartsEnabled`

A Command mode Quarkus project using Maven as build tool:

mvn io.quarkus:quarkus-maven-plugin:create -DcodestartsEnabled \
-DprojectGroupId=org.acme -DprojectArtifactId=go-go-commando
cd go-go-commando
# ./mvnw.cmd on Windows
./mvnw package
java -jar target/go-go-commando-1.0-SNAPSHOT-runner.jar

Same as previous using Gradle as build tool:

mvn io.quarkus:quarkus-maven-plugin:create -DcodestartsEnabled \
-DprojectGroupId=org.acme -DprojectArtifactId=go-go-commando-gradle \
-DbuildTool=GRADLE
cd go-go-commando-gradle
# ./gradlew.bat on Window
./gradlew build
java -jar build/go-go-commando-gradle-1.0-SNAPSHOT-runner.jar

A Quarkus project in Kotlin with example for RESTEasy and Qute:

mvn io.quarkus:quarkus-maven-plugin:create -DcodestartsEnabled \
-DprojectGroupId=org.acme -DprojectArtifactId=kotlin-with-rest-is-qute \
-Dextensions=kotlin,resteasy,qute
cd kotlin-with-rest-is-qute
# ./mvnw.cmd on Windows
./mvnw quarkus:dev

A blank Quarkus project in Scala with SmallRye Reactive Messaging Kafka

mvn io.quarkus:quarkus-maven-plugin:create -DcodestartsEnabled \
-DprojectGroupId=org.acme -DprojectArtifactId=scala-kafka \
-Dextensions=scala,quarkus-smallrye-reactive-messaging-kafka \
-DskipExample
cd scala-kafka
# ./mvnw.cmd on Windows
./mvnw quarkus:dev
We added instructions to get you started (contextual to the extensions and build tool you’ve selected) in the new project README.md .

Start a blank Quarkus application with your favorites tools/extensions

Codestarts also introduce a huge improvement 😅 and don’t laugh, it has been a legitimate demand from the community for a while now, using Codestarts, you can generate a blank Quarkus app by adding: -DskipExample.

You might notice a few missing features with Codestarts

  1. The package name of the generated examples is now fixed to org.acme, we thought it wouldn’t add much value to make it customizable, but let us know if you find it’s a loss.

  2. Since a project will contain multiple examples, we must avoid conflicts, this is why you can’t define the REST path in your app anymore.

BUGS WANTED

Codestarts are still in preview mode in Quarkus 1.7.x for the sake of stabilization but we would like to make it the default behavior as soon as possible. So please give it a try and report any bug you may find :-)

Contributing an example codestart

If you have an extension and would like to provide a codestart for it:

Feel free to contact us via Zulip or the Quarkus Development mailing list for any question or suggestion.

Here are the Codestarts core code, and the base codestarts used to scaffold your Quarkus application.

The door is now open to an endless new playground

We already have new codestarts in the pipeline for the next Quarkus release! And what if you could use your own set of personal/company codestarts? To be continued…​