Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

KumuluzEE Version example

This sample demonstrates how to use KumuluzEE Version.


In order to run this example you will need the following:

  1. Java 8 (or newer), you can use any implementation:

    • If you have installed Java, you can check the version by typing the following in a command line:

      java -version
  2. Maven 3.2.1 (or newer):

    • If you have installed Maven, you can check the version by typing the following in a command line:

      mvn -version
  3. Git:

    • If you have installed Git, you can check the version by typing the following in a command line:

      git --version


This sample is based on the KumuluzEE JAX-RS sample, with only a few new dependencies, plugins and files.


The example uses maven to build and run the microservice.

  1. Build the sample using maven:

    $ cd jax-rs
    $ mvn clean package
  2. Run the sample:

  • Uber-jar:

    $ java -jar target/${}.jar

    in Windows environemnt use the command

    java -jar target/${}.jar
  • Exploded:

    $ java -cp target/classes:target/dependency/*

    in Windows environment use the command

    java -cp target/classes;target/dependency/*

The application/service can be accessed on the following URL:

To shut down the example simply stop the processes in the foreground.


This tutorial will show you how to enable KumuluzEE Version.

Add Maven dependencies

Dependencies are the same as in the jax-rs example with the addition of:



We will be using the maven resources plugin to get the group_id, maven_version etc. and also the maven buildnumber plugin, to get the git commit id. We only need to specify the buildnumber plugin in pom.xml


You can set doCheck to true, to make building fail if there are any locally modified files. Setting doUpdate to true will update your local repository from remote before building.

Adding VERSION.json

We have to add a file, that will be edited by the plugins and from which versioning will be read from.

We will create a VERSION.json file in the resources folder with the following content:

  "maven_group_id": "${project.groupId}",
  "maven_artifact_id": "${project.parent.artifactId}",
  "maven_version": "${project.version}",
  "project_artifactId": "${project.artifactId}",
  "git_commit_id": "${buildNumber}"

These fields will then be exposed by the servlet. When running this example in exploded format, the maven buildnumber plugin fills the value with key "git_commit_id" with "", which gets logged as an error. This can be avoided by running the example in an Uber-jar format.

Enabling version servlet

The servlet exposing version information have to be manually enabled with the configuration key kumuluzee.version.endpoint.

    endpoint: /version

Setting custom values

We can set custom values that will then be exposed by the servlet for example we set the docker image name in config.yaml file in resources folder with:

    endpoint: /version
      docker-image-name: my_docker_image

This sets the "docker_image_name" key to m̀y_docker_image. This can be overwritten with an environment variable KUMULUZEE_VERSION_VALUES_DOCKERIMAGENAME.

Setting resources folder

We have to set the resources folders, so that the plugins know in which folders to look for files that have fields that need to be filled.


Note that if you have a custom name of the VERSION.json file, you also have to change it here.

Build the microservice and run it

To build the microservice and run the example, use the commands as described in previous sections.

You can’t perform that action at this time.