我要评分
获取效率
正确性
完整性
易理解

"UnknownHostException" Displayed in the spring-cloud-launcher-cli Module

Symptom

During the compilation of Spring-Cloud-cli, the spring-cloud-launcher-cli module fails to be compiled. The error message "UnknownHostException" is displayed.

Key Process and Cause Analysis

The host is not mapped. Add proxy configurations to solve the problem.

Conclusion and Solution

  1. Open the LauncherCommand.java file.
    vim /home/spring-cloud-cli/spring-cloud-launcher/spring-cloud-launcher-cli/src/main/java/org/springframework/cloud/launcher/cli/LauncherCommand.java
  2. Add the following content below line 22:
    import java.util.Properties;

  3. Add the following content below line 52:
     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.

  4. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. Run the compile command again.
    ./mvnw clean install -Dgpg.skip=true