Issue
I am having an issue where the buildpack I am using as part of a native build with Spring Boot cannot download the required JDK to build the container image. It is not aware of my proxy settings for my corporate proxy.
Getting errors that cant download the JDK as cant locate the host - classic proxy issue.
What is the best way to set the proxy settings for a buildpack to use when using these packs as part of the Spring Boot native plugin (in my case Gradle).
I have tried:
- Setting proxy in my gradle.properties
- Setting proxy in my gradle-wreapper.properties
- Setting proxy within the IDE I am running gradle in
- Setting HTTP_PROXY and HTTPS_PROXY env properties in Windows.
Thanks
Thanks,
Solution
OK, managed to solve this one finally.
So the key was the HTTP_PROXY
and HTTPS_PROXY
setting, but had to put it in the correct place.
For me that was in the environment
portion of the bootBuildImage
gradle DSL.
/**
* Configure (Ahead-Of-Time) AOT Task.
*/
springAot {
mode = AotMode.NATIVE // NATIVE is default
debugVerify = false // false is default
removeXmlSupport = false // true is default
removeSpelSupport = true // false is default
removeYamlSupport = true // false is default
removeJmxSupport = true // true is default
verify = true // true is default
}
/**
* Native Image Configuration.
*/
bootBuildImage {
builder = 'paketobuildpacks/builder:tiny'
environment = [
'BP_NATIVE_IMAGE': 'true',
'HTTP_PROXY' : 'http://www-myproxy.org:43924',
'HTTPS_PROXY' : 'http://www-myproxy.org:43924'
]
}
That did the trick. The buildpack was able to detect the environment property correctly then and route the request to download items via the proxy properly.
Answered By - astropcr
Answer Checked By - David Goodson (JavaFixing Volunteer)