【发布时间】:2020-10-01 06:50:51
【问题描述】:
我正在尝试从代理后面使用 spring boot 2.3.0 构建 docker 映像。
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.0.RELEASE</version>
<configuration>
<image>
<env>
<HTTP_PROXY>http://proxy.example.com</HTTP_PROXY>
<HTTPS_PROXY>https://proxy.example.com</HTTPS_PROXY>
</env>
</image>
</configuration>
</plugin>
但我无法让它发挥作用。但是,当使用 BPL_ 为变量添加前缀时,我可以让它工作,如下所示
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.0.RELEASE</version>
<configuration>
<image>
<env>
<BPL_HTTP_PROXY>http://proxy.example.com</BPL_HTTP_PROXY>
<BPL_HTTPS_PROXY>https://proxy.example.com</BPL_HTTPS_PROXY>
</env>
</image>
</configuration>
</plugin>
所以这是一个错误,或者我不明白的东西。
更好的是,这可以像从命令行一样在 pom 之外指定吗?我正在使用 powershell。
【问题讨论】:
-
我遇到了同样的问题,但是看起来该功能是 2.4 版附带的,而不是 2.3 版的
-
你可以在这里阅读docs.spring.io/spring-boot/docs/2.4.0/maven-plugin/reference/…。我用 2.4.3 对其进行了测试,它可以工作。
-
谢谢@jim-sellers,我遇到了
Get "https://github.com/bell-sw/Liberica/releases/download/11.0.13+8/bellsoft-jre11.0.13+8-linux-amd64.tar.gz": dial tcp 140.82.112.4:443: connect: connection timed out,不知道在哪里配置代理。您使用<configuration><image><env><HTTP_PROXY/><HTTPS_PROXY/></env></image></configuration>的第一个示例终于成功了。
标签: spring spring-boot docker maven containers