I'm running this command to build docker
image using maven
and jib
mvn compile jib:dockerBuild -Djib.to.image="$IMAGE_NAME"
this command works perfectly fine on my machine since it's going to download some stuff from the internet, however, it's not the case when I try to run it within a pipeline (on AWS) that is going to run in a corporate network that requires a proxy
I have already tried this command:
export MAVEN_OPTS="-DsocksProxyHost=<host> -DsocksProxyPort=<port>"
but it didn't work, and I don't want to touch the settings.xml
file because I don't have access to it, so the only solution I'm loking for is to provide a proxy with the command listed above.
this is the whole log of the command:
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/kr/motd/maven/os-maven-plugin/1.6.2/os-maven-plugin-1.6.2.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin kr.motd.maven:os-maven-plugin:1.6.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for kr.motd.maven:os-maven-plugin:jar:1.6.2 @
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.bla:backend:1.0-SNAPSHOT (/codebuild/output/src794035415/src/backend/pom.xml) has 1 error
[ERROR] Unresolveable build extension: Plugin kr.motd.maven:os-maven-plugin:1.6.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for kr.motd.maven:os-maven-plugin:jar:1.6.2: Could not transfer artifact kr.motd.maven:os-maven-plugin:pom:1.6.2 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/kr/motd/maven/os-maven-plugin/1.6.2/os-maven-plugin-1.6.2.pom: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginManagerException
[Container] 2021/02/26 11:15:48 Command did not exit successfully cd backend && mvn compile jib:dockerBuild -Dhttp.proxyHost=http://path/to/proxy -Dhttp.proxyPort=8080 -Djib.to.image="$JAVA_SERVICE_IMAGE_NAME" && cd .. exit status 1
[Container] 2021/02/26 11:15:48 Phase complete: BUILD State: FAILED_WITH_ABORT
[Container] 2021/02/26 11:15:48 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: cd backend && mvn compile jib:dockerBuild -Dhttp.proxyHost=http://path/to/proxy -Dhttp.proxyPort=8080 -Djib.to.image="$JAVA_SERVICE_IMAGE_NAME" && cd ... Reason: exit status 1