"java.net.UnknownHostException:repo1.maven.org" Displayed When Compiling Spring Boot
Symptom
A spring-boot-cli UnknownHostException:repo1.maven.org test error occurs during the spring-boot-cli compilation. The message "java.net.UnknownHostException:repo1.maven.org" is displayed.

Key Process and Cause Analysis
The host is not mapped. Add proxy configurations to solve the problem.
Conclusion and Solution
- Open the CompositeProxySelector.java file.
vim /home/spring-boot/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/CompositeProxySelector.java
- Add the following content below line 19:
import java.util.Properties;
- Add the following content below line 32:
static { Properties props = System.getProperties(); props.put("http.proxyHost", "127.0.0.1"); props.put("http.proxyPort", "3128"); props.put("https.proxyHost", "127.0.0.1"); props.put("https.proxyPort", "3128"); }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.

Run the :set list command to check the format. Spaces are not allowed. Use Tab to indent the code.
- Press Esc, type :wq!, and press Enter to save the file and exit.
Parent topic: Troubleshooting