Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling Gradle

  1. Go to the /home directory.
    1
    cd /home
    
  2. Download the Gradle v4.8.1 source code.
    1
    wget https://github.com/gradle/gradle/archive/v4.8.1.zip --no-check-certificate
    
  3. Decompress the Gradle source package.
    1
    unzip v4.8.1.zip
    
  4. Rename it Gradle and go to the gradle directory.
    1
    2
    mv gradle-4.8.1 gradle
    cd gradle
    
  5. Modify the NativePlatforms.java file.
    1. Open the file.
      1
      vim subprojects/platform-native/src/main/java/org/gradle/nativeplatform/platform/internal/NativePlatforms.java
      
    2. 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));

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Configure Gradle.
    1. Open the gradle-wrapper.properties file.
      1
      vim gradle/wrapper/gradle-wrapper.properties
      
    2. 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

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Download the Gradle source code.
      1
      wget https://services.gradle.org/distributions/gradle-4.8-rc-3-bin.zip --no-check-certificate
      
    5. Move the gradle-4.8-rc-3-bin.zip source package to the gradle/wrapper/ directory.
      1
      mv gradle-4.8-rc-3-bin.zip gradle/wrapper/
      
  7. Modify the build.gradle.kts file.
    1. Open the file.
      vim buildSrc/build.gradle.kts
    2. 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")

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  8. Configure the Java proxy. Replace the example Java version with the actual one.
    1. 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
    2. 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

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  9. 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.
      Figure 1 javax.net.ssl.SSLHandshakeException
  10. View the generated JAR package.
    1
    ls subprojects/platform-native/build/libs/