Compiling and Installing Spring Boot
- Obtain the Spring-Boot source code.
- Go to the home directory on the server.
1cd /home
- Download the Spring-Boot source package.
- Spring Boot 2.2.2: https://github.com/spring-projects/spring-boot/archive/v2.2.2.RELEASE.tar.gz
- Spring Boot 2.2.6: https://github.com/spring-projects/spring-boot/archive/v2.2.6.RELEASE.tar.gz
Run the following command to download the package. In the command, x.x.x indicates the version number.1wget 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.
- Go to the home directory on the server.
- Decompress the source package.
1tar -zxvf vx.x.x.RELEASE.tar.gz
- Change the name of the decompressed source package to spring-boot and go to the source code directory.
1mv spring-boot-x.x.x.RELEASE spring-boot && cd spring-boot
- Switch to the spring-project/spring-boot directory.
1cd spring-boot-project/spring-boot
- 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.
- Open the pom.xml file.
1vim pom.xml - 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>
- Add the following content below line 83:
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the pom.xml file.
- Go to the spring-boot-project/spring-boot-starters/spring-boot-starter-webflux directory.
1cd ../spring-boot-starters/spring-boot-starter-webflux/
- Remove the dependency of netty-transport-native-epoll on the x86-64 version.
- Open the pom.xml file.
1vim pom.xml - 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.
- Open the pom.xml file.
- Switch to the spring-boot-starter-artemis directory.
1cd ../spring-boot-starter-artemis
- Remove the dependency of netty-transport-native-epoll on the x86-64 version.
- Open the pom.xml file.
1vim pom.xml - 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>
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the pom.xml file.
- Switch to the spring-boot-starter-rsocket directory.
1cd ../spring-boot-starter-rsocket
- Remove the dependency of netty-transport-native-epoll on the x86-64 version.
- Open the pom.xml file.
1vim pom.xml - 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>
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the pom.xml file.
- Configure Cntlm.
If a proxy is required for the server to access the Internet, configure Cntlm. For details, see Configuring Cntlm.
- 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:
- 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
- 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.
- 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
- 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
- Create the library directory if it does not exist.
- 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.
Parent topic: Spring Boot Porting Guide