Gradle Tool Failed Download

553 views
Skip to first unread message

Sverre Moe

unread,
Aug 7, 2019, 12:51:37 PM8/7/19
to Jenkins Users
This has worked before. Now that we where to upgrade from Gradle 5.0 to 5.5 and added the tool gradle-5.5 it fails to retrieve the archive.

Anyone have an idea what the problem might be?

Running both Jenkins and Agents on Java 8 Update 221.

Is there any way arround this without hacking the JRE cacerts with the gradle web site certificate?

sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297)
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
	at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
	at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:290)
	at java.base/sun.security.validator.Validator.validate(Validator.java:264)
	at java.base/sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:321)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:221)
	at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:626)
Caused: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:642)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:461)
	at java.base/sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:361)
	at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:448)
	at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:425)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:178)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
	at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2768)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2680)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1843)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:329)
	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:874)
Caused: java.io.IOException: Failed to install https://services.gradle.org/distributions/gradle-5.5.1-bin.zip to /home/build/jenkins-test/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.5
	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:938)
	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:846)
	at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:77)
	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
	at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:92)
	at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:30)
	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

Sverre Moe

unread,
Aug 7, 2019, 1:10:53 PM8/7/19
to Jenkins Users
I don't think this is a problem with the Tool as I get the same problem trying manually on the agent

build@jbssles123x64:~/workspace/meos-dashboard> gradle wrapper --gradle-version=5.5.1
build@jbssles123x64:~/workspace/project> ./gradlew --version
Downloading https://services.gradle.org/distributions/gradle-5.5.1-bin.zip

Gives same Stacktrace.

Mark Waite

unread,
Aug 7, 2019, 1:28:15 PM8/7/19
to Jenkins Users
I would guess that you may already be using a modified cacerts file which does not include the authority that is certifying the validity of the SSL certificate on the gradle site.

When I download from that URL, my web browser reports no issues from Google Chrome on Windows and no issues from wget on a FreeBSD computer.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/93ecd2ab-622a-4306-ad97-6546972c3471%40googlegroups.com.


--
Thanks!
Mark Waite

Sverre Moe

unread,
Aug 7, 2019, 1:56:19 PM8/7/19
to Jenkins Users
I have no modifed cacerts.

Using wget also fails on the agent, until I set a proxy.
The Jenkins server does have proxy configured, but not the agents.
When I add HTTP Proxy in Jenkins under the Update Center I get a totally different stacktrace when it tries to retrieve the gradle tool.

Unpacking https://services.gradle.org/distributions/gradle-5.5.1-bin.zip to /home/build/jenkins-test/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.5 on master-sles12.3-x86_64_2
ERROR: Failed to download https://services.gradle.org/distributions/gradle-5.5.1-bin.zip from agent; will retry from master
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
	at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)
	at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)
	at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:392)
Caused: sun.security.validator.ValidatorException: PKIX path building failed
	at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:397)
	at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:302)
	at sun.security.validator.Validator.validate(Validator.java:262)
	at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:330)
	at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:237)
	at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1621)
Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to master-sles12.3-x86_64_2
		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1743)
		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:357)
		at hudson.remoting.Channel.call(Channel.java:957)
		at hudson.FilePath.act(FilePath.java:1070)
		at hudson.FilePath.act(FilePath.java:1059)
		at hudson.FilePath.installIfNecessaryFrom(FilePath.java:913)
		at hudson.FilePath.installIfNecessaryFrom(FilePath.java:846)
		at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:77)
		at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
		at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
		at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
		at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:92)
		at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:30)
		at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
		at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
		at java.base/java.lang.Thread.run(Thread.java:834)
Caused: javax.net.ssl.SSLHandshakeException
	at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
	at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:316)
	at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:310)
	at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1639)
	at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:223)
	at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1037)
	at sun.security.ssl.Handshaker.process_record(Handshaker.java:965)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1064)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1367)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1395)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1379)
	at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
	at sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2735)
	at sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2647)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1830)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:268)
	at java.net.URL.openStream(URL.java:1057)
	at hudson.FilePath$Unpack.invoke(FilePath.java:949)
	at hudson.FilePath$Unpack.invoke(FilePath.java:943)
	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3050)
	at hudson.remoting.UserRequest.perform(UserRequest.java:212)
	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
	at hudson.remoting.Request$2.run(Request.java:369)
	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131)
	at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
	at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
	at java.base/sun.security.ssl.Alert$AlertConsumer.consume(Alert.java:285)
	at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:181)
	at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:164)
	at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1152)
	at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1063)
	at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:402)
	at java.base/sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:567)
	at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect0(HttpURLConnection.java:2768)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.followRedirect(HttpURLConnection.java:2680)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1843)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:3084)
	at java.base/java.net.URLConnection.getHeaderFieldLong(URLConnection.java:636)
	at java.base/java.net.URLConnection.getContentLengthLong(URLConnection.java:508)
	at java.base/java.net.URLConnection.getContentLength(URLConnection.java:492)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getContentLength(HttpsURLConnectionImpl.java:389)
	at org.jvnet.robust_http_client.RetryableHttpStream.<init>(RetryableHttpStream.java:90)
Caused: javax.net.ssl.SSLHandshakeException: Received fatal alert: access_denied
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1963)
	at java.base/sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1958)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1957)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1525)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1509)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:245)
	at org.jvnet.robust_http_client.RetryableHttpStream.getStream(RetryableHttpStream.java:98)
	at org.jvnet.robust_http_client.RetryableHttpStream.<init>(RetryableHttpStream.java:91)
	at hudson.ProxyConfiguration.getInputStream(ProxyConfiguration.java:285)
	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:924)
Caused: java.io.IOException: Failed to install https://services.gradle.org/distributions/gradle-5.5.1-bin.zip to /home/build/jenkins-test/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.5
	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:938)
	at hudson.FilePath.installIfNecessaryFrom(FilePath.java:846)
	at hudson.tools.DownloadFromUrlInstaller.performInstallation(DownloadFromUrlInstaller.java:77)
	at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:69)
	at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
	at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
	at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:92)
	at hudson.plugins.gradle.GradleInstallation.forNode(GradleInstallation.java:30)
	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:152)
	at org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:133)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

onsdag 7. august 2019 19.28.15 UTC+2 skrev Mark Waite følgende:
I would guess that you may already be using a modified cacerts file which does not include the authority that is certifying the validity of the SSL certificate on the gradle site.

When I download from that URL, my web browser reports no issues from Google Chrome on Windows and no issues from wget on a FreeBSD computer.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.


--
Thanks!
Mark Waite

Mark Waite

unread,
Aug 7, 2019, 2:51:09 PM8/7/19
to Jenkins Users
Maybe this is the time to reconfigure the tool installer to download from a locally cached copy of the tool instead of pulling it from the internet?

I've had good results with that technique by placing zip files of the tool installers inside my network and then configuring the tool installer to use the copy from my network instead of the copy from the internet.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4f6bdea1-95fd-4237-a7d7-b2f4c0834046%40googlegroups.com.


--
Thanks!
Mark Waite

Sverre Moe

unread,
Aug 7, 2019, 3:04:09 PM8/7/19
to Jenkins Users
I thought of the same.
I downloaded the Gradle distribution zip file. Placed it in our Nexus Repository Manager, in a raw repository.

Used the Installer "Extract *.zip/*.tar.gz". Did not go so well
Tool: gradle-5.5
File: gradle-5.5.1-bin.zip

Get extracted in
hudson.plugins.gradle.GradleInstallation/gradle-5.5/gradle-5.5.1

My pipeline script suspects to find the gradle executable under ${gradleTool}/bin/gradle.

The GradleInstaller unpacks it under the tool name.

onsdag 7. august 2019 20.51.09 UTC+2 skrev Mark Waite følgende:
Maybe this is the time to reconfigure the tool installer to download from a locally cached copy of the tool instead of pulling it from the internet?

I've had good results with that technique by placing zip files of the tool installers inside my network and then configuring the tool installer to use the copy from my network instead of the copy from the internet.



--
Thanks!
Mark Waite

Sverre Moe

unread,
Aug 7, 2019, 3:10:59 PM8/7/19
to Jenkins Users
Perhaps I could use instead the Installers "Run Shell Command", or "Run Batch Command".
Then unpack it myself, ensuring it gets unpacked within the tool name directory.
Would I need both in order for it to work on Linux and Windows?

Sverre Moe

unread,
Aug 7, 2019, 3:37:54 PM8/7/19
to Jenkins Users
Got it working using the "Run Shell Command". Though I find it very cumbersome.

wget --quiet https://nexus.company.no:8443/repository/gradle-distributions/gradle-5.5.1-bin.zip
unzip
-qq gradle-5.5.1-bin.zip
mv gradle
-5.5.1/* .
rmdir gradle-5.5.1
rm gradle-5.5.1-bin.zip

Richard Bywater

unread,
Aug 7, 2019, 4:00:53 PM8/7/19
to jenkins...@googlegroups.com
Personally with Gradle I've always found it easier to use Gradle Wrapper instead of full installs.

Don't know if that's an option for you or not. 

Richard.

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/af4494fc-4010-4421-a9c3-b87406426b03%40googlegroups.com.

Sverre Moe

unread,
Aug 7, 2019, 5:42:57 PM8/7/19
to Jenkins Users
I am not very keen on checking in the gradle wrapper to git. Though I do see the appeal.

Now with Gradle 5.5 I am planning on creating a custom Gradle distribution and storing it with Nexus NXRM.
https://docs.gradle.org/5.5/userguide/organizing_gradle_projects.html#sec:custom_gradle_distribution

onsdag 7. august 2019 22.00.53 UTC+2 skrev Richard Bywater følgende:
Personally with Gradle I've always found it easier to use Gradle Wrapper instead of full installs.

Don't know if that's an option for you or not. 

Richard.

Sverre Moe

unread,
Aug 9, 2019, 8:32:53 AM8/9/19
to Jenkins Users
I get the same problem trying to get the gradle wrapper on our build agents.

Using Proxy with gradle fixes that problem:
gradle wrapper --gradle-version=5.5.1
./gradlew -Dhttps.proxyHost=proxy.company.com -Dhttps.proxyPort=3128 --version

Is there a way to get Jenkins to use this proxy when downloading the Gradle distribution?
I have configured Jenkins to use our Proxy under the Plugin Manager > Advanced.

However considering we want to create our own Gradle distribution now that has become an option after 5.5, I think we would to stick with the option of unpacking the installer our self using "Run Shell Command".

Sverre Moe

unread,
Sep 23, 2019, 8:28:30 AM9/23/19
to Jenkins Users
Jenklns has no problem downloading Maven tools, but fails downloading Gradle tools.

Unpacking https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip to /home/build/jenkins/tools/hudson.tasks.Maven_MavenInstallation/maven-3.6.1 on sles12.3-x86_64_1

Unpacking https://services.gradle.org/distributions/gradle-5.6.2-bin.zip to
/home/build/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.6.2 on sles12.3-x86_64_1
ERROR: Failed to download https://services.gradle.org/distributions/gradle-5.6.2-bin.zip from agent; will retry from master
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


Which makes me believe that the Gradle tool does not use Jenkins Proxy settings, while Maven tools does use it.

Daniel Beck

unread,
Sep 23, 2019, 8:37:53 AM9/23/19
to jenkins...@googlegroups.com
On Mon, Sep 23, 2019 at 2:28 PM Sverre Moe <sverr...@gmail.com> wrote:
ERROR: Failed to download https://services.gradle.org/distributions/gradle-5.6.2-bin.zip from agent; will retry from master
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


Which makes me believe that the Gradle tool does not use Jenkins Proxy settings, while Maven tools does use it.

The error means it's an SSL issue. If you're on an old JRE, update it. 

Jan Monterrubio

unread,
Sep 23, 2019, 12:25:04 PM9/23/19
to jenkins...@googlegroups.com
I’ve always relied on projects supplying the gradle wrapper instead... that might be a good alternative if you can’t upgrade the JRE

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMo7PtLJW%2BeMQ-509sB%2Bv%2BdAtz_%3DDudWMsiE-eCdZYfduAPcyA%40mail.gmail.com.

Sverre Moe

unread,
Sep 23, 2019, 4:26:10 PM9/23/19
to Jenkins Users
I have gotten this problem both for Jenkins running Java 8u221 and Java 11.0.4+11. The latest for both 8 and 11.

Maven tool download works just fine, using the same JDK, so why would the gradle installer have a problem?

I do not like to check in the gradle wrapper files into version control, but considering it might ease new developers I am beginning to lean into it.


mandag 23. september 2019 18.25.04 UTC+2 skrev Jan Monterrubio følgende:
I’ve always relied on projects supplying the gradle wrapper instead... that might be a good alternative if you can’t upgrade the JRE
On Mon, Sep 23, 2019 at 05:37 Daniel Beck <db...@cloudbees.com> wrote:


On Mon, Sep 23, 2019 at 2:28 PM Sverre Moe <sver...@gmail.com> wrote:
ERROR: Failed to download https://services.gradle.org/distributions/gradle-5.6.2-bin.zip from agent; will retry from master
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target


Which makes me believe that the Gradle tool does not use Jenkins Proxy settings, while Maven tools does use it.

The error means it's an SSL issue. If you're on an old JRE, update it. 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.

Sverre Moe

unread,
Sep 25, 2019, 4:30:17 AM9/25/19
to Jenkins Users
The Gradle tool installer is not the only tool having this problem. I am getting the same SSL problem with Groovy tool installers.

Makes me wonder, what does the maven tool installer do different than the Gradle and Groovy tool installers.

Sverre Moe

unread,
Sep 25, 2019, 4:41:32 AM9/25/19
to Jenkins Users
Which projects has the source code for the Maven, Gradle and Groovy Tool installers? I want to have a check to see if there is something to be done on the Gradle and Groovy tool installers.

Sverre Moe

unread,
Sep 25, 2019, 4:59:54 AM9/25/19
to Jenkins Users
Both the MavenInstaller and GradleInstaller are very similar

public static class MavenInstaller extends DownloadFromUrlInstaller {
public class GradleInstaller extends DownloadFromUrlInstaller {

I thought perhaps they used different implementation, and that was the reason for why GradleInstaller had problems.


Both Jenkins Server and Build agents are behind a firewall. The Jenkins has proxy configured, but the build agents do not have any proxy configured.
I have same problem using Gradle wrapper, but as mentioned earlier here gradle wrapper works if I configure proxy properties.

Daniel Beck

unread,
Sep 25, 2019, 5:13:13 AM9/25/19
to jenkins...@googlegroups.com
Run the following in the Jenkins script console:

hudson.ProxyConfiguration.getInputStream(new URL("https://services.gradle.org/distributions/gradle-5.6.2-bin.zip")).text.substring(0, 100)

Note that this loads the entire downloaded file, if successful, into memory, so not quite production quality code ;-)

Replace the URL as needed to try whatever URLs are listed as being downloaded with the different installers. The expectation for zip files is that the output starts with "PK". If the same exception gets thrown for Groovy/Gradle, while Maven works, it's SSL after all. (Gradle Wrapper would run probably on a different machine, with different JRE, so that doesn't tell you much.)


To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a8ae71dc-3515-499c-a038-26a80eebc3a0%40googlegroups.com.


--

Daniel Beck
Senior Software Engineer
CloudBees, Inc.

CloudBees-Logo.png


Sverre Moe

unread,
Sep 25, 2019, 5:38:23 AM9/25/19
to Jenkins Users
There is no Exception thrown when running that in script console.

Result: PK
A
gradle-5.6.2/ PK
AĘ|����H !gradle-5.6.2/getting-start

Same for Maven
hudson.ProxyConfiguration.getInputStream(new URL("https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip")).text.substring(0, 100)
Result: PK  
 B� O apache-maven-3.6.2/PK  
 =� O apache-maven-3.6.2/li


onsdag 25. september 2019 11.13.13 UTC+2 skrev Daniel Beck følgende:
Run the following in the Jenkins script console:

hudson.ProxyConfiguration.getInputStream(new URL("https://services.gradle.org/distributions/gradle-5.6.2-bin.zip")).text.substring(0, 100)

Note that this loads the entire downloaded file, if successful, into memory, so not quite production quality code ;-)

Replace the URL as needed to try whatever URLs are listed as being downloaded with the different installers. The expectation for zip files is that the output starts with "PK". If the same exception gets thrown for Groovy/Gradle, while Maven works, it's SSL after all. (Gradle Wrapper would run probably on a different machine, with different JRE, so that doesn't tell you much.)


Sverre Moe

unread,
Sep 25, 2019, 7:02:23 AM9/25/19
to Jenkins Users
I thought about using "Extract *.zip/*.tar.gz instead, and pointing it to a custom Gradle distribution at an inhouse URL.

However the gradle distribution is unpackaged into a second subdirectory:
    /jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.6/gradle-5.6.1
While the tool gives me the directory:
    /jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.6
And I expect gradle executable should be:
    ${gradleTool}/bin/gradle

Unpacking https://nexus.company.no:8443/repository/gradle-distributions/gradle-5.6.1-bin.zip to /home/build/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.6 on sles12.3-x86_64_4

+ /home/build/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.6/bin/gradle -version
/home/build/jenkins/workspace/pipeline-tests/pipeline-gradle-tools@tmp/durable-81b2542a/script.sh: line 1: /home/build/jenkins/tools/hudson.plugins.gradle.GradleInstallation/gradle-5.6/bin/gradle: No such file or directory


I have been trying to use a "Shell command" instead, but am having difficulty scripting a quick no-op if the tool is already installed. Getting none of the Bash magic for checking empty directory to work.
Reply all
Reply to author
Forward
0 new messages