Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to select JDK through Rainbond source code to build JAVA project

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "how to build JAVA project through Rainbond source code to select JDK". In daily operation, I believe many people have doubts about how to build JAVA project through Rainbond source code to select JDK. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubt of "how to build JAVA project through Rainbond source code". Next, please follow the editor to study!

JDK provided by default

Rainbond officially provides several versions of OpenJDK for users to use. These OpenJDK installation packages are hosted in Haoyu's official OSS (object Storage). The Rainbond platform that can access the Internet can obtain these resources through the agents of rbd-repo components without human intervention.

Users can configure it through the WEB interface, or create a system.properties in the source root directory, and set java.runtime.version to specify the OpenJDK version.

The value set by the WEB interface takes precedence over the value set in system.properties.

The WEB interface specifies:

The method specified by system.properties:

# system.properties the current version value that Rainbond can recognize is 11, 10, 1.9, 1.8, 1.7, 1.7, 1.6, java.runtime.version1.8.

Without making any other adjustments, the following versions of OpenJDK resources are obtained when Rainbond performs a source build:

OpenJDK version Resource address 1.8 (default) http://lang.goodrain.me/jdk/cedar-14/openjdk1.8.0_201.tar.gz1.6http://lang.goodrain.me/jdk/openjdk1.6.0_27.tar.gz1.7http://lang.goodrain.me/jdk/cedar-14/openjdk1.7.0_201.tar.gz1.9http://lang.goodrain.me/jdk/cedar-14/openjdk9.0.4.tar.gz10http: / / lang.goodrain.me/jdk/cedar-14/openjdk10.0.2.tar.gz11 http://lang.goodrain.me/jdk/cedar-14/openjdk11.0.2.tar.gz

Special reminder: if an error occurs during the compilation of maven, please download the corresponding JDK to your own environment and try to build locally to confirm whether the compilation failed due to OpenJDK version problems.

Custom JDK

Most users want to be able to customize JDK, such as using a specific version of OpenJDK, or have permission to use OracleJDK with Oracle. Next, I'll explain how to customize it.

The Rainbond platform integrates Artifactory from Jforg as a product library (that is, rbd-repo components). Here we can upload and store our own resources, including jdk packages.

First, visit http://:8081 and log in to Artifactory. The default credential is admin/password.

Create a custom local product repository and upload a custom jdk package.

It is important to note that the default limit for Artifactory to upload files is no more than 100MB. If the uploaded file exceeds this limit, you can set the File Upload Max Size entry to an appropriate value in the Admin > General Configuration page.

Specify a custom JDK address in the platform WEB interface, and the setting is the application building source.

For the jdk package uploaded in the above way, the address is: http://:8081/artifactory//

Similar: http://192.168.1.1:8081/artifactory/jdk2/jdk-8u201-linux-x64.tar.gz

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 the drawback is that the JDK acquisition address has to be set in every new application. Is there a way to replace the default JDK package provided by Rainbond? If you can do this, wouldn't it be convenient to install a specified version of JDK within your company without having to make other settings for each build and use the default path?

The address of the default JDK actually points to the official object store of Rainbond, which is a kind of remote remote repository for Artifactory. In Artifactory, there is no way to replace files in a remote repository by uploading files. So we need to set up another warehouse locally to replace the remote warehouse provided by the Rainbond official.

Here are the detailed steps:

Use the official rbd-java-buildpack image provided by Rainbond as the basis, and create the image with the self-needed JDK package (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 we use OracleJDK1.8 as an example to replace it, and users change it according to their own needs

Dockerfile content:

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

Build operation:

Docker build-t goodrain.me/buildpack:java-v5.1.5.

Start the service

Edit the specified profile in the management node:

# vi / opt/rainbond/conf/base.yaml# append-name: rbd-java-buildpack endpoints:-name: BUILDPACK_ENDPOINTS protocol: port: 2017 health: name: rbd-java-buildpack model: http address: 127.0.0.1:2017/lang/ max_errors_num: 3 time_interval: 30 after:-docker type: simple pre_start: docker rm rbd-java-buildpack start: >-docker run-- name rbd -java-buildpack-- network host-I goodrain.me/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 warehouse pkg_lang in Artifactory to http://:2017/lang:

If you have already obtained the JDK package from the Rainbond official remote repository, clear the cached record in pkg_lang-cache.

The default OpenJDK1.8 version has now been replaced with the specified OracleJDK1.8 version.

At this point, the study on "how to build a JAVA project through Rainbond source code to select JDK" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report