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.
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
We added a feature flag in the Quarkus Maven plugin to create your application:
mvn io.quarkus:quarkus-maven-plugin:create -DcodestartsEnabled`
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
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
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
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
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:
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.
Since a project will contain multiple examples, we must avoid conflicts, this is why you can’t define the REST
pathin your app anymore.
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 :-)
If you have an extension and would like to provide a codestart for it: