This is a small, lightweight service built on top of Quarkus to perform multiplication operations.
You can run your application in dev mode that enables live coding using:
mvn compile quarkus:dev
The application can be packaged using:
mvn package
It produces the quarkus-app/quarkus-run.jar
file in the /target
directory. Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib
directory.
If you want to build an über-jar, execute the following command:
mvn package -Dquarkus.package.jar.type=uber-jar
The application is now runnable using java -jar target/multiplication-service-{version}-runner.jar
.
You can create a native executable using:
mvn package -Pnative
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
mvn package -Pnative -Dquarkus.native.container-build=true
You can then execute your native executable with: ./target/multiplication-service-{version}-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html.
Simply run the application with:
$ mvn clean quarkus:dev -Dquarkus.http.port=8282
In a new terminal, execute a curl
command to the root path:
$ curl -X POST \ -H 'Content-Type:application/json'\ -H 'Accept:application/json' \ -d '{"leftElement" : "5", "rightElement": "2" }' \ http://localhost:8282/
And expect a reply like this:
{"multiplication":{"leftElement":5.0,"rightElement":2.0,"product":10.0}}