gradlegitlabgitlab-cihttp-proxyjava-opts

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


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?


Solution

  • 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"