Java Maven

How to deploy Java-based Maven project?

If you do not have code ready, you can fork the repository being used in this example:


We are going to deploy a simple hello world java api, that will have a single endpoint:

/ -> Hello world


Choose your repo first:

Choose repo

Next, select JavaGradle deployment: Java Maven select

To choose a correct Java version, open up the terminal and type:

$ java --version
Picked up _JAVA_OPTIONS: -Xmx1024M
openjdk 2020-11-04
OpenJDK Runtime Environment AdoptOpenJDK (build
OpenJDK 64-Bit Server VM AdoptOpenJDK (build, mixed mode)

Choose major version like 11 or 13.

On the final screen, enter the following settings: Java Maven settings

Build command:

#Default build command, will create out folder
mvn package -B

#Run tests first
mvn test package -B


#For monorepo example

Port to expose:

#Choose port 8080 (default) as ssl is provided automatically

Deploy folder:

#Build command deploys into out

Run command:

#Take project name from pom.xml: project.artifactId-project.version.jar
java -jar helloworld-0.0.1-SNAPSHOT.jar

After that you can visit your api and see how easy it was to deploy it: Deployed

Note: if you need to configure which spring profile file to use, set environment variable SPRING_PROFILES_ACTIVE to production/dev/staging - Set runtime environment variables

Edit this page on GitHub Updated at Wed, May 17, 2023