> gradle.properties - echo "systemProp.http.pro" /> > gradle.properties - echo "systemProp.http.pro" /> > gradle.properties - echo "systemProp.http.pro"/>

How to set up Gradle proxy variables in gitlab-ci.yaml with JAVA_OPTS

1.3k Views Asked by At

I have the next code in .gitlab-ci.yml:

before_script:
- echo "systemProp.http.proxyHost=$PROXY_HOST" >> gradle.properties
- echo "systemProp.http.proxyPort=$PROXY_PORT" >> gradle.properties
- echo "systemProp.https.proxyHost=$PROXY_HOST" >> gradle.properties
- echo "systemProp.https.proxyPort=$PROXY_PORT" >> gradle.properties

As seen I'm using env. variables $PROXY_PORT and $PROXY_HOST to set up Gradle proxy properties. How I can do this via JAVA_OPTS or GRADLE_OPTS variables?

1

There are 1 best solutions below

0
Stanislav On BEST ANSWER

Just try to use this code snippet instead of your's:

 variables:
     JAVA_TOOL_OPTIONS: "-Dhttps.proxyHost=$CODE_PROXY_HOST -Dhttps.proxyPort=$CODE_PROXY_PORT -Dhttps.nonProxyHosts= your_no_proxy_host"