Home > Java > javaTutorial > body text

How to Configure Gradle Proxy Settings for Web Access?

Mary-Kate Olsen
Release: 2024-11-02 23:05:30
Original
258 people have browsed it

How to Configure Gradle Proxy Settings for Web Access?

Gradle Proxy Configuration for Web Access

Gradle integration with Artifactory in Jenkins requires web access via a proxy server. Configuring this proxy connection can be challenging, especially when using a backslash in the proxy username or when multiple proxy servers are present.

To specify proxy settings for Gradle, create a .gradle/gradle.properties file in your home directory and include the following properties:

systemProp.http.proxyHost = hostname
systemProp.http.proxyPort = 8080
systemProp.http.proxyUser = de\username
systemProp.http.proxyPassword = xxx
Copy after login

However, this configuration may lead to HTTP 407 errors. To overcome these issues, use the following refinement based on Daniel's response:

HTTP Only Proxy Configuration:

gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 "-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost"
Copy after login

HTTPS Only Proxy Configuration:

gradlew -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129 "-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost"
Copy after login

Both HTTP and HTTPS Proxy Configuration:

gradlew -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=3129 "-Dhttp.nonProxyHosts=*.nonproxyrepos.com|localhost"
Copy after login

Proxy Configuration with User 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"
Copy after login

These properties can also be added to the gradle-wrapper.properties file. Alternatively, setting these options in Jenkins' or Artifactory's GUI should also work.

The above is the detailed content of How to Configure Gradle Proxy Settings for Web Access?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!