This repository contains the complete source code for the application built in the freeCodeCamp tutorial "Gatting Started with Quarkus and JPAStreamer".
-
Java 11 or later
-
Docker
-
Sakila database running in a Docker container, see instructions here.
The application makes use of the MySQL Sakila sample database. To download and run it as a Docker container on port 3306, run:
$ docker run -d --publish 3306:3306 --name mysqld restsql/mysql-sakila
Note
|
This Docker image was built for ARM64 architecture, thus if you are running on e.g. an M1 Mac, you need to instruct Docker to accept images built for a different platform by appending the flag --platform linux/amd64 after docker run in the above command.
|
Here is an overview of the relevant part of the schema:
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
Note
|
The Quarkus Dev UI is available in dev mode only at http://localhost:8080/q/dev/. |
Note
|
To test your endpoints using Swagger, visit http://localhost:8080/q/swagger-ui/. |
The application can be packaged using:
./mvnw package
It produces the quarkus-run.jar
file in the target/quarkus-app/
directory.
Note
|
Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib/ directory.
|
The application is now runnable using java -jar target/quarkus-app/quarkus-run.jar
.
If you want to build an über-jar, execute the following command:
./mvnw package -Dquarkus.package.type=uber-jar
The application, packaged as an über-jar, is now runnable using java -jar target/*-runner.jar
.
You can create a native executable using:
./mvnw package -Pnative
Or, if you don’t have GraalVM installed, you can run the native executable build in a container using:
./mvnw package -Pnative -Dquarkus.native.container-build=true
You can then execute your native executable with: ./target/quarkus-tutorial-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult Maven tooling.