Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling and Installing Spring Boot

  1. Obtain the Spring-Boot source code.
    1. Go to the home directory on the server.
      1
      cd /home
      
    2. Download the Spring-Boot source package.
      Run the following command to download the package. In the command, x.x.x indicates the version number.
      1
      wget https://github.com/spring-projects/spring-boot/archive/vx.x.x.RELEASE.tar.gz --no-check-certificate
      

      You can also download the source code using a local browser and upload the source code to the home directory on the server.

  2. Decompress the source package.
    1
    tar -zxvf vx.x.x.RELEASE.tar.gz
    
  3. Change the name of the decompressed source package to spring-boot and go to the source code directory.
    1
    mv spring-boot-x.x.x.RELEASE spring-boot && cd spring-boot
    
  4. Switch to the spring-project/spring-boot directory.
    1
    cd spring-boot-project/spring-boot
    
  5. Remove the dependency of netty-transport-native-epoll on the x86-64 version, and add the dependency of netty-transport-native-epoll on the AArch64 version.
    1. Open the pom.xml file.
      1
      vim pom.xml
      
    2. Press i to enter the insert mode and modify the following content.
      • Add the following content below line 83:
                          <dependency>
                                  <groupId>io.netty</groupId>
                                  <artifactId>netty-transport-native-epoll</artifactId>
                                  <version>4.1.43.Final</version>
                                  <classifier>linux-aarch_64</classifier>
                                  <scope>compile</scope>
                                  <exclusions>
                                          <exclusion>
                                                  <artifactId>commons-logging</artifactId>
                                                  <groupId>commons-logging</groupId>
                                          </exclusion>
                                  </exclusions>
                          </dependency>

      • Add the following content below line 100:
                                 <exclusions>
                                         <exclusion>
                                                 <groupId>io.netty</groupId>
                                                 <artifactId>netty-transport-native-epoll</artifactId>
                                         </exclusion>
                                 </exclusions>

      • Add the following content below line 121:
                                 <exclusions>
                                     <exclusion>
                                         <groupId>io.projectreactor.netty</groupId>
                                             <artifactId>reactor-netty</artifactId>
                                     </exclusion>
                                 </exclusions>

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  6. Go to the spring-boot-project/spring-boot-starters/spring-boot-starter-webflux directory.
    1
    cd ../spring-boot-starters/spring-boot-starter-webflux/
    
  7. Remove the dependency of netty-transport-native-epoll on the x86-64 version.
    1. Open the pom.xml file.
      1
      vim pom.xml
      
    2. Press i to enter the insert mode and modify the following content.
      Add the following content below line 33:
                                <exclusions>
                                      <exclusion>
                                                <groupId>io.netty</groupId>
                                                <artifactId>netty-transport-native-epoll</artifactId>
                                      </exclusion>
                                </exclusions>

      Press Esc, type :wq!, and press Enter to save the file and exit.

  8. Switch to the spring-boot-starter-artemis directory.
    1
    cd ../spring-boot-starter-artemis
    
  9. Remove the dependency of netty-transport-native-epoll on the x86-64 version.
    1. Open the pom.xml file.
      1
      vim pom.xml
      
    2. Press i to enter the insert mode and modify the following content.
      Add the following content below line 37:
                                      <exclusion>
                                              <groupId>io.netty</groupId>
                                              <artifactId>netty-transport-native-epoll</artifactId>
                                      </exclusion>

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  10. Switch to the spring-boot-starter-rsocket directory.
    1
    cd ../spring-boot-starter-rsocket
    
  11. Remove the dependency of netty-transport-native-epoll on the x86-64 version.
    1. Open the pom.xml file.
      1
      vim pom.xml
      
    2. Press i to enter the insert mode and modify the file. Then save the file and exit.
      Add the following content below line 31:
                              <exclusions>
                                    <exclusion>
                                              <groupId>io.netty</groupId>
                                              <artifactId>netty-transport-native-epoll</artifactId>
                                    </exclusion>
                              </exclusions>

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  12. Configure Cntlm.

    If a proxy is required for the server to access the Internet, configure Cntlm. For details, see Configuring Cntlm.

  13. Save the netty-transport-native-epoll-4.1.43.Final-linux-aarch_64.jar and netty-transport-native-epoll-4.1.48.Final.jar packages of the ARM64 architecture to the local Maven repository.
    • For CentOS 7.6/openEuler 20.03, see Failed to Obtain netty-transport-native-epoll.
    • For CentOS 8.1, perform the following operations:
      1. Create the library directory if it does not exist.
        mkdir -p /root/.m2/repository/io/netty/netty-transport-native-epoll/4.1.43.Final
        mkdir -p /root/.m2/repository/io/netty/netty-transport-native-epoll/4.1.48.Final
      2. Obtain the netty-transport-native-epoll-4.1.43.Final-linux-aarch_64.jar and netty-transport-native-epoll-4.1.48.Final.jar packages.
      3. You can also obtain the JAR package for CentOS 8.1 by following instructions in netty-transport-native-epoll-4.1.43.Final-linux-aarch_64.jar Porting Guide.
        wget https://mirrors.huaweicloud.com/kunpeng/maven/io/netty/netty-transport-native-epoll/4.1.43.Final/netty-transport-native-epoll-4.1.43.Final-linux-aarch_64.jar --no-check-certificate
        wget https://mirrors.huaweicloud.com/kunpeng/maven/io/netty/netty-transport-native-epoll/4.1.48.Final/netty-transport-native-epoll-4.1.48.Final.jar --no-check-certificate
      4. Save the JAR package to the local Maven repository.
        mv netty-transport-native-epoll-4.1.43.Final-linux-aarch_64.jar /root/.m2/repository/io/netty/netty-transport-native-epoll/4.1.43.Final
        mv netty-transport-native-epoll-4.1.48.Final.jar /root/.m2/repository/io/netty/netty-transport-native-epoll/4.1.48.Final
  14. Perform the compilation and installation.
    cd /home/spring-boot
    mvn clean install

    If an error is reported during the compilation, rectify the fault based on the error information. For details, see Troubleshooting. After the fault is rectified, run the compilation and installation commands again.

    mvn spring-javaformat:apply clean install

    If the Java file (*.java) has been modified, add the compilation parameter spring-javaformat:apply to the compilation and installation command.