spring-cloud-function Dependency Pulling Failure
Symptom
If the compilation environment requires a proxy for connecting to the Internet, dependencies may fail to be pulled.

Key Process and Cause Analysis
The compilation environment needs to access the Internet through a proxy.
Conclusion and Solution
You can configure a proxy, or replace the Maven repository with the Huawei Maven repository to solve the problem.
Method 1: Configuring a Proxy
- Open the DependencyResolver.java file.
vim ./spring-cloud-function-compiler/src/main/java/org/springframework/cloud/function/compiler/java/DependencyResolver.java
- Modify the following code. Save the file and exit.
- Add the following content below line 81:
import org.eclipse.aether.repository.Proxy;

- Modify line 280 as follows:
.setReleasePolicy(policy(input.getReleases()))
- Add the following content to line 281:
.setProxy(new Proxy("https","127.0.0.1",3128)).build();In the preceding example, 127.0.0.1 and 3128 indicate the IP address and port number of the proxy host. Replace them with the actual ones.

- Add the following content below line 81:
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the RuntimeJavaCompilerTests.java file.
vim ./spring-cloud-function-compiler/src/test/java/org/springframework/cloud/function/compiler/java/RuntimeJavaCompilerTests.java
- In line 142, change find to transfer.

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the compile command again.
./mvnw clean install -Dgpg.skip=true
Method 2: Replacing the Maven Repository with the Huawei Maven Repository
- Open the DependencyResolver.java file.
vim ./spring-cloud-function-compiler/src/main/java/org/springframework/cloud/function/compiler/java/DependencyResolver.java
- Change the Maven repository to Huawei Kunpeng Maven.

- Add the IP address of the Huawei Kunpeng Maven repository to /etc/hosts.
1 2
echo 172.30.163.193 mirrors.huaweicloud.com >> /etc/hosts cat /etc/hosts
- Add a proxy for the spring-cloud-function-deployer module.
vim spring-cloud-function-deployer/src/it/settings.xml
Change the values of username, password, host and port as required.

- Run the compile command again.
./mvnw clean install -Dgpg.skip=true
Parent topic: Troubleshooting