Gradle Proxy Configuration
Configuring Gradle to access the internet through a proxy server is crucial for seamless integration with remote repositories or third-party services. When using the build-info-extractor-gradle plugin to connect to Artifactory, it's essential to specify the proxy settings correctly.
To set up HTTP or HTTPS proxy configuration, add the following properties to your .gradle/gradle.properties file:
To provide credentials for the proxy, include these properties: -Dhttp.proxyUser=[user name] and -Dhttp.proxyPassword=[password] (or -Dhttps.proxyUser and -Dhttps.proxyPassword for HTTPS proxies).
To exclude specific hosts from proxy tunneling, use the -Dhttp.nonProxyHosts=[host names] property.
Example:
Consider the following scenario:
To configure Gradle with this proxy, add the following properties to your .gradle/gradle.properties file:
-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3128 -Dhttp.proxyUser=user -Dhttp.proxyPassword=pass -Dhttp.nonProxyHosts=host1.com|host2.com
Remember, you can also set these properties in gradle-wrapper.properties for project-wide proxy configuration.
The above is the detailed content of How to Configure Gradle to Use a Proxy Server?. For more information, please follow other related articles on the PHP Chinese website!