Not able to build DevTest docker containers with gradlew - java.net.UnknownHostException: services.gradle.org

Document ID : KB000014402
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

You may be on a system trying to build the docker containers for DevTest, where you do not have internet access.  Its expected when running the gradlew scipt that the host will have access to the internet.  If this is not the case, you will need to apply the change below

Question:

When I run my gradlew script,  I get the following error.  How do I resolve this issue.

 

[root@mydocr docker]# ./gradlew build

Downloading https://services.gradle.org/distributions/gradle-2.3-bin.zip

 

Exception in thread "main" java.lang.RuntimeException: java.net.UnknownHostException: services.gradle.org

at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)

at org.gradle.wrapper.Install.createDist(Install.java:44)

at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)

at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:55)

Caused by: java.net.UnknownHostException: opt

at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)

at java.net.Socket.connect(Socket.java:589)

at java.net.Socket.connect(Socket.java:538)

at sun.net.ftp.impl.FtpClient.doConnect(FtpClient.java:957)

at sun.net.ftp.impl.FtpClient.tryConnect(FtpClient.java:917)

at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:1012)

at sun.net.ftp.impl.FtpClient.connect(FtpClient.java:998)

at sun.net.www.protocol.ftp.FtpURLConnection.connect(FtpURLConnection.java:294)

at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(FtpURLConnection.java:393)

at org.gradle.wrapper.Download.downloadInternal(Download.java:56)

at org.gradle.wrapper.Download.download(Download.java:42)

at org.gradle.wrapper.Install$1.call(Install.java:57)

at org.gradle.wrapper.Install$1.call(Install.java:44)

at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)

... 3 more

[root@mydocr docker]# 

Answer:

You can resolve this issue by the following steps.   Assume you have installed DevTest in /opt/CA/DevTest

 

1) Download the file gradle-2.3-bin.zip from this URL on your workstation https://services.gradle.org/distributions/gradle-2.3-bin.zip

2) Copy the zip file and place it in /opt/CA/DevTest/docker/gradle/wrapper/

3) Modify /opt/CA/DevTest/docker/gradle/wrapper/gradle-wrapper.properties  and change the following line

     distributionURL=https\://services.gradle.org/distributions/gradle-2.3-bin.zip

     to this

     distributionUrl=file:///opt/CA/DevTest/docker/gradle/wrapper/gradle-2.3-bin.zip

When you run your gradlew script,  it will use the zip installer to install the gradle package.