Chapter 2. Scaffolding
In this chapter, you’ll learn about creating the project structure of Quarkus. Quarkus comes with some different ways to scaffold a project.
You’ll learn how to do the following:
-
Scaffold a project in different ways, from Maven to VSCode IDE
-
Improve developer experience with the live reloading
-
Serve static resources with Quarkus
2.1 Scaffolding a Quarkus Project with Maven
Problem
You want to start quickly in Quarkus by generating a simple project.
Solution
Use the Quarkus Maven plug-in.
Discussion
Using the Quarkus Maven plug-in creates a simple project that is ready to be deployed and contains the following:
-
A pom.xml file with minimal Quarkus dependencies
-
A simple JAX-RS resource
-
A test for the JAX-RS resource
-
A native test
-
Dockerfiles to generate a container
-
An empty configuration file
We assume you’ve already installed Apache Maven. Open a terminal and execute the following command:
mvn io.quarkus:quarkus-maven-plugin:1.4.1.Final:create \-DprojectGroupId=org.acme \-DprojectArtifactId=getting-started \-DclassName="org.acme.quickstart.GreetingResource" \-Dpath="/hello"
The project has this structure:
├── mvnw├── mvnw.cmd├── pom.xml└── src├── main│ ├── docker│ │ ├── Dockerfile.jvm│ │ └── Dockerfile.native│ ├── java│ │ └── org│ │ └── acme│ │ └── quickstart│ │ └── GreetingResource.java ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access