Compiling Gradle
- Go to the /home directory.
1cd /home
- Download the Gradle v4.8.1 source code.
1wget https://github.com/gradle/gradle/archive/v4.8.1.zip --no-check-certificate
- Decompress the Gradle source package.
1unzip v4.8.1.zip - Rename it Gradle and go to the gradle directory.
1 2
mv gradle-4.8.1 gradle cd gradle
- Modify the NativePlatforms.java file.
- Open the file.
1vim subprojects/platform-native/src/main/java/org/gradle/nativeplatform/platform/internal/NativePlatforms.java - Press i to enter the insert mode and modify the following content.
- Add the following content below line 44:
ArchitectureInternal aarch64 = Architectures.forInput("aarch64");
- Add the following content below line 73:
platforms.add(createPlatform(linux, aarch64));

- Add the following content below line 44:
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Configure Gradle.
- Open the gradle-wrapper.properties file.
1vim gradle/wrapper/gradle-wrapper.properties - Press i to enter the insert mode, comment out line 3, and add the following content to line 4:
distributionUrl=gradle-4.8-rc-3-bin.zip

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Download the Gradle source code.
1wget https://services.gradle.org/distributions/gradle-4.8-rc-3-bin.zip --no-check-certificate
- Move the gradle-4.8-rc-3-bin.zip source package to the gradle/wrapper/ directory.
1mv gradle-4.8-rc-3-bin.zip gradle/wrapper/
- Open the gradle-wrapper.properties file.
- Modify the build.gradle.kts file.
- Open the file.
vim buildSrc/build.gradle.kts
- Press i to enter the insert mode and add the following content to lines 75 and 76:
maven(url = "https://maven.aliyun.com/repository/public/") maven(url = "https://maven.aliyun.com/repository/gradle-plugin")

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the file.
- Configure the Java proxy. Replace the example Java version with the actual one.
- Open the /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-7.oe1.aarch64/jre/lib/net.properties file.
vim /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-7.oe1.aarch64/jre/lib/net.properties
- Press i to enter the insert mode and add the following content to the file (modify based on actual requirements):
http.proxyHost=proxysg.huawei.com http.proxyPort=8080 http.nonProxyHosts=localhost|127.*|[::1] https.proxyHost=proxysg.huawei.com https.proxyPort=8080

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.272.b10-7.oe1.aarch64/jre/lib/net.properties file.
- Build Gradle.
1 2
cd /home/gradle ./gradlew
If a proxy is used, run the following commands. Configure the host name, port number, user name, and password of the proxy based on the actual proxy environment.
./gradlew -Dhttp.proxyHost=proxysg.huawei.com -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxysg.huawei.com -Dhttps.proxyPort=8080 -Dhttps.proxyUser= -Dhttps.proxyPassword= -Dhttp.proxyUser= -Dhttp.proxyPassword=
If "BUILD SUCCESSFUL" is displayed, the build is successful.
- If an error message is displayed stating "Received status code 407 from server: authenticationrequired", "unable to find valid certification path to requested target", or "validity check failed", see Configure the Certificate.
- If the error message "Received status code 502 from server: Parent proxy unreacheable" is displayed during the compilation, the network proxy cannot obtain resources. You are advised to change the network environment.
- If the error message "javax.net.ssl.SSLHandshakeException" is displayed, as shown in Figure 1, rectify the fault by following the instructions provided in Failed to Download Gradle.
- If the error message "Connection refused" is displayed during Gradle compilation, see "Connection refused" Displayed During Gradle Compilation.
- View the generated JAR package.
1ls subprojects/platform-native/build/libs/
Parent topic: Performing the Compilation and Installation
