spring-cloud-commons Maven Repository Issue
Symptom
If the compilation environment requires a proxy for connecting to the Internet, dependencies may fail to be pulled.
The following information is displayed:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project spring-cloud-test-support: There are test failures. [ERROR] [ERROR] Please refer to /home/spring-cloud-commons/spring-cloud test support/target/surefire reports for the individual test results.[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.

Key Process and Cause Analysis
The compilation environment needs to access the Internet through a proxy.
Conclusion and Solution
Method 1: Configuring Proxy
- Modify the ModifiedClassPathRunner.java file.
vim spring-cloud-test-support/src/main/java/org/springframework/cloud/test/ModifiedClassPathRunner.java
- Press i to enter the insert mode and modify the file.
- Add the following content below line 42:
import org.eclipse.aether.repository.Proxy;

- Comment out lines 222 to 224, and add the following content to lines 225 to 230:
RemoteRepository.Builder builder = new RemoteRepository.Builder("central", "default", "https://repo.maven.apache.org/maven2"); RemoteRepository remoteRepository = builder .setProxy(new Proxy("https", "127.0.0.1", 3128)).build(); CollectRequest collectRequest = new CollectRequest(null, Arrays.asList(remoteRepository));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 42:
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Run the compile command again.
mvn clean install -Dgpg.skip=true
Method 2: Replacing the Hard-coded Maven Repository Address in the Source Code with the Kunpeng Maven Repository Address
- Open the ModifiedClassPathRunner.java file.
vim spring-cloud-test-support/src/main/java/org/springframework/cloud/test/ModifiedClassPathRunner.java
- Comment out line 223 and add the following content to line 224.
"https://mirrors.huaweicloud.com/maven").build()));

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Add the IP address of Huawei Maven to the /etc/hosts file.
172.30.163.193 mirrors.huaweicloud.com
- Run the compile command again.
mvn clean install -Dgpg.skip=true
Parent topic: Troubleshooting