Home > Java > javaTutorial > How to Configure Gradle to Work Behind a Proxy Server?

How to Configure Gradle to Work Behind a Proxy Server?

Susan Sarandon
Release: 2024-11-02 10:37:02
Original
1100 people have browsed it

How to Configure Gradle to Work Behind a Proxy Server?

Gradle Proxy Configuration

Gradle requires access to the web to integrate with services such as Artifactory. When working behind a proxy server, you may encounter issues if proper configuration is not set.

Manual Proxy Configuration

As described in the question, manually adding the Artifactory plugin and defining proxy settings in .gradle/gradle.properties can be unsuccessful.

Solution

The provided solution offers a more detailed configuration approach:

  • HTTP Proxy:
    gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128"-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost"
  • HTTPS Proxy:
    gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129 "-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost"
  • Both HTTP and HTTPS Proxy:
    gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129"-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost"
  • Proxy with Username and Password:
    gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129 -Dhttps.proxyUser=user -Dhttps.proxyPassword=pass -Dhttp.proxyUser=user -Dhttp.proxyPassword=pass -Dhttp.nonProxyHosts=host1.com|host2.com"

The above configurations can be placed in either gradle.properties (in home directory or project directory) or gradle-wrapper.properties.

The above is the detailed content of How to Configure Gradle to Work Behind a Proxy Server?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template