---
title: 编译spring-boot-cli提示java.net.UnknownHostException:repo1.maven.org的解决方法
description: "编译spring-boot-cli过程中遇到spring-boot-cli UnknownHostException:repo1.maven.org测试问题，提示“java.net.UnknownHostException:repo1.maven.org”。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengwebs/ecosystemEnable/SpringBoot/kunpengspringboot_02_0033.html
sourcePath: /source/zh/kunpengwebs/ecosystemEnable/SpringBoot/kunpengspringboot_02_0033.html
indexId: 03530bc2ed69161f1607a851e586fe5eb65b84a74ea9b35907e6c713a3cd9dc580
---
# 编译spring-boot-cli提示java.net.UnknownHostException:repo1.maven.org的解决方法

#### 问题现象描述

编译spring-boot-cli过程中遇到spring-boot-cli UnknownHostException:repo1.maven.org测试问题，提示“java.net.UnknownHostException:repo1.maven.org”。


#### 关键过程、根本原因分析

Host未建立映射关系，可以通过增加代理配置解决。


#### 结论、解决方案及效果

1. 打开CompositeProxySelector.java文件。

```
vim /home/spring-boot/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/grape/CompositeProxySelector.java
```


2. 在第19行的下一行添加以下内容。

```
import java.util.Properties;
```


3. 在第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");
}
```


  其中，127.0.0.1和3128分别表示代理主机的IP地址和端口，操作时请根据实际代理环境配置。

  请使用:set list检查格式。不能出现空格，请使用Tab作为代码缩进。

4. 按“Esc”键，输入:wq!，按“Enter”保存并退出编辑。
