Home > Java > javaTutorial > body text

How to Configure Proxy Authentication and User Credentials in Gradle for Jenkins Integration with Artifactory?

DDD
Release: 2024-11-05 05:57:02
Original
780 people have browsed it

How to Configure Proxy Authentication and User Credentials in Gradle for Jenkins Integration with Artifactory?

Gradle Proxy Configuration: Troubleshooting Proxy Authentication and User Credentials

When integrating Jenkins with Artifactory using the Gradle/Artifactory plugin, connecting to the proxy server through Gradle may encounter errors. One common issue arises when the proxy requires authentication, such as proxy servers that return HTTP 407 (Proxy authentication required).

To resolve this, the proxy configuration must be explicitly set in Gradle. However, the given configuration in .gradle/gradle.properties uses the systemProp property prefix, which is intended for system properties, not Gradle-specific properties.

Instead, use the following syntax within a .gradle or gradle.properties file:

gradle.proxyHost = "hostname"
gradle.proxyPort = 8080
gradle.proxyUser = "username"
gradle.proxyPassword = "password"
Copy after login

Additionally, ensure that the username specified contains a backslash character (), not a forward slash (/). If credentials for a separate user are required, specify those credentials in the configuration.

HTTP and HTTPS Proxy Configuration

Beyond HTTP proxy configuration, situations may arise where either HTTP or HTTPS protocols require separate proxies or if both protocols need to be configured. The following syntax demonstrates these scenarios:

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

Remember to specify the appropriate URLs in the -Dhttp.nonProxyHosts parameter for the hosts that should not be routed through the proxy.

By following these guidelines, you should be able to successfully configure proxy access within Gradle and leverage the Gradle/Artifactory integration in Jenkins.

The above is the detailed content of How to Configure Proxy Authentication and User Credentials in Gradle for Jenkins Integration with Artifactory?. 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
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!