Kato Java Project from Source

JDK Provided by Default

Kato officially provides multiple versions of OpenJDK for users to use. These OpenJDK installation packages are hosted in the official OSS (Object Storage) of Gridworkz Technology. The Kato platform that can access the Internet can obtain these resources through the agent of the rbd-repo component without manual intervention.

The user configures through the WEB interface, or creates system.properties in the source root directory, and sets java.runtime.version to specify the OpenJDK version.

The value set in the WEB interface has a higher priority than the value set in system.properties.

WEB interface designation:

system.properties specification method:

# system.properties The current version values ​​that Kato can recognize are 11, 10, 1.9, 1.8, 1.7, 1.6

Without making any other adjustments, when Kato executes source code building, it will obtain the following versions of OpenJDK resources:

OpenJDK versionResource address
1.8 (default)http://lang.gridworkz/jdk/cedar-14/openjdk1.8.0_201.tar.gz

Special reminder: If an error occurs during the maven compilation process, please download the corresponding JDK to your own environment and try to build it locally to confirm whether the compilation fails due to the OpenJDK version.

Custom JDK

Most users want to be able to customize the JDK, such as using a specific version of OpenJDK, or having Oracle’s authorization to use OracleJDK. Next, I will explain how to customize.

The Kato platform integrates Artifactory produced by Jfrog as a product library (i.e. rbd-repo component). Here we can upload and store our own resources, including jdk packages.

  • First, visit http://<management node IP>:8081 to log in to Artifactory, the default credentials: admin/password
  • Create a custom local product repository and upload a custom jdk package.

It should be noted that the default limit for uploading files in Artifactory is not to exceed 100MB. If the uploaded file exceeds this limit, you can set the File Upload Max Size item to an appropriate value on the Admin> General Configuration page.

  • Specify a custom JDK address on the platform WEB interface, and the setting is the application build source.

The address of the jdk package uploaded as above is: http://:8081/artifactory//


At this point, the custom JDK is complete.

Replace the default JDK

Custom JDK has a higher degree of freedom and can adapt to more usage scenarios. But its shortcoming is that the JDK acquisition address must be set in every new application. Is there a way to replace the JDK package provided by Kato by default? If this function can be realized, wouldn’t it be convenient to use the default path to install the JDK of the company’s internal specified version without any other settings for each build?

The default JDK address actually points to Kato’s official object storage, which is a kind of remote repository for Artifactory. In Artifactory, there is no way to upload files to replace files in remote repositories. Therefore, we have to build another repository locally to replace the remote repository officially provided by Kato.

Next are the detailed steps:

  • Use the official rbd-java-buildpack image provided by Kato as the basis, combined with the self-needed JDK package to make an image (take the default version 1.8 as an example)
#The file structure of the build directory is as follows:
├── Dockerfile
└── jdk-8u201-linux-x64.tar.gz #Here uses OracleJDK1.8 as an example to replace, and users can change them according to their needs

Dockerfile content:

FROM kato/buildpack:java-v5.1.5
COPY jdk-8u201-linux-x64.tar.gz /pkg/lang/jdk/cedar-14/openjdk1.8.0_201.tar.gz

Build operation:

docker build -t gridworkz/buildpack:java-v5.1.5 .
  • Start service

Edit the specified configuration file on the management node:

#vi /opt/kato/conf/base.yaml
#Append at the end
- name: rbd-java-buildpack
    port: 2017
    name: rbd-java-buildpack
    model: http
    max_errors_num: 3
    time_interval: 30
    - docker
  type: simple
  pre_start: docker rm rbd-java-buildpack
  start: >-
    docker run --name rbd-java-buildpack
    --network host
    -i gridworkz/buildpack:java-v5.1.5
  stop: docker stop rbd-java-buildpack
  restart_policy: always

Start the service:

node service update
  • Modify the remote address of the remote repository pkg_lang in Artifactory to http://<management node IP>:2017/lang:

If you have already used Kato official remote repository to obtain the JDK package, then clear the cached records in pkg_lang-cache.

So far, the default OpenJDK1.8 version has been replaced with the specified OracleJDK1.8 version.


Based on this article, users can flexibly master the ways to configure and use various JDKs.

After this article, we will continue to publish articles on how to flexibly configure the Maven environment, so stay tuned.