Skip to Content
Quarkus Cookbook
book

Quarkus Cookbook

by Alex Soto Bueno, Jason Porter
July 2020
Intermediate to advanced
392 pages
7h 20m
English
O'Reilly Media, Inc.
Book available
Content preview from Quarkus Cookbook

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 1
    │   │   ├── 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.
Start your free trial

You might also like

Java Cookbook, 4th Edition

Java Cookbook, 4th Edition

Ian F. Darwin
Vert.x in Action

Vert.x in Action

Julien Ponge
React Cookbook

React Cookbook

David Griffiths, Dawn Griffiths
JavaScript Cookbook, 3rd Edition

JavaScript Cookbook, 3rd Edition

Adam D. Scott, Matthew MacDonald, Shelley Powers

Publisher Resources

ISBN: 9781492062646Errata PageSupplemental Content