Gradle build problem

I’m using the raspberry pi image this year, and I’m having some problems building the example code. I try to use ./gradlew build in the directory the readme says to, but I just get a notification about gradle downloading and then an error:

Exception in thread “main” java.net.UnknownHostException: services.gradle.org
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:220)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:591)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:285)
at java.base/sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:182)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
at java.base/sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:265)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:372)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1181)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1075)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1581)
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.gradle.wrapper.Download.downloadInternal(Download.java:66)
at org.gradle.wrapper.Download.download(Download.java:51)
at org.gradle.wrapper.Install$1.call(Install.java:62)
at org.gradle.wrapper.Install$1.call(Install.java:48)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:69)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

Any idea how I should fix this? I’m also open to running the build process on my development laptop, which I know is an option, but I don’t know how to get the files back and forth. Should I use SCP, or plug the pi into my computer somehow, or what?

The webdash Application tab has links to download .zip files for each of the example programs to your desktop for compilation. You can then upload your compiled program back up to the Pi via the Application tab. Building directly on the Pi isn’t supported without an internet connection to the Pi (at least initially).

Ah, I see. I have the zip files now, but I’m having some trouble compiling. The readme suggests I should be using gradle from the command line, which I’m entirely new to. I have gradle installed on my windows dev laptop, but running gradle build doesn’t seem to be doing anything. It says build successful, but I can’t find any jars anywhere. Which directory should I be running the command from, if at all? Or, should I just be using something else entirely? Sorry if these questions are a little basic, I’ve not used the raspberry pi for anything before.

You don’t need gradle installed—the point of the gradlew.bat is it downloads its own copy of Gradle. You will need Java 11 installed as your system Java; it doesn’t use the FRC installed one (we aren’t unified with the vscode stuff this year).

Running gradlew.bat doesn’t seem to be doing anything either. It says build successful, but there’s still no build folder or any compiled jars anywhere. Am I missing something?

You’re running “.\gradlew.bat build” from the command prompt, correct? It may also be worth running a “.\gradlew clean” first, then doing the build. What is the console output from the build command?

Running it like that just throws the following. It’s like all of the jars that are packaged aren’t being found in their default locations. I haven’t moved them.

C:\Users\FIRST\Desktop\java-multiCameraServer\java-multiCameraServer>gradlew.bat build

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine the dependencies of task ‘:shadowJar’.

Could not resolve all dependencies for configuration ‘:runtimeClasspath’.
Could not find :wpiutil:.
Searched in the following locations:
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/usr/local/frc/java/wpiutil.jar
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/wpiutil.jar
Required by:
project :
Could not find :ntcore:.
Searched in the following locations:
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/usr/local/frc/java/ntcore.jar
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/ntcore.jar
Required by:
project :
Could not find :cscore:.
Searched in the following locations:
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/usr/local/frc/java/cscore.jar
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/cscore.jar
Required by:
project :
Could not find :cameraserver:.
Searched in the following locations:
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/usr/local/frc/java/cameraserver.jar
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/cameraserver.jar
Required by:
project :
Could not find :opencv-344:.
Searched in the following locations:
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/usr/local/frc/java/opencv-344.jar
- file:/C:/Users/FIRST/Desktop/java-multiCameraServer/java-multiCameraServer/opencv-344.jar
Required by:
project :

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s

Yup, moving those dependencies down one directory worked.

Ah, you’re using the 2019.1.1 image. We fixed that (and several other things) in 2019.2.1. I’m looking at doing a 2019.3.1 release later this weekend so you may want to wait just a bit to upgrade though.

Ah, cool. One last issue: when I click save on the uploaded jar file section, the chosen file just reverts to “no file chosen”. Is this a bug, or am I doing something wrong? (I did update to 2.1, just to check if that was the issue.)

That means the save worked. I have an issue open to give better “success” feedback.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.