wpilibsuite / vscode-wpilib

Visual Studio Code WPILib extensions
Other
111 stars 49 forks source link

Build Robot Code error #111

Closed cfernan62 closed 6 years ago

cfernan62 commented 6 years ago

I created a project in VSCode and get this error when I "Build Robot Code":

Executing task: gradlew assemble <

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

Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alerts.getSSLException(Unknown Source) at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.Handshaker.fatalSE(Unknown Source) at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source) at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source) at sun.security.ssl.Handshaker.processLoop(Unknown Source) at sun.security.ssl.Handshaker.process_record(Unknown Source) at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) 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) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(Unknown Source) at sun.security.validator.PKIXValidator.engineValidate(Unknown Source) at sun.security.validator.Validator.validate(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source) ... 21 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source) at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source) at java.security.cert.CertPathBuilder.build(Unknown Source) ... 27 more The terminal process terminated with exit code: 1

Did I fail to configure gradle?

Thanks for your assistance!

ThadHouse commented 6 years ago

What version of Java are you using? OpenJDK before 11 doesn't properly work with gradle, so you need to use oracle jdk 8 for the alpha.

cfernan62 commented 6 years ago

I'm running Java 8 update 161. javaversion

ThadHouse commented 6 years ago

Weird. You have internet? I just saw that error on our CI provider as well, and rerunning the build seemed to fix the issue. Is the error still there after rerunning?

cfernan62 commented 6 years ago

Rerunning build resulting in the same message.

Just in case, here's the content of my gradle.build file:

plugins { id "java" id "edu.wpi.first.GradleRIO" version "2019.0.0-alpha-3" }

def ROBOT_CLASS = "frc.robot.Robot"

// Define my targets (RoboRIO) and artifacts (deployable files) // This is added by GradleRIO's backing project EmbeddedTools. deploy { targets { target("roborio", edu.wpi.first.gradlerio.frc.RoboRIO) { // Team number is loaded either from the .wpilib/wpilib_preferences.json // or from command line. If not found an exception will be thrown. // You can use getTeamOrDefault(team) instead of getTeamNumber if you // want to store a team number in this file. team = getTeamNumber() } } artifacts { artifact('frcJava', edu.wpi.first.gradlerio.frc.FRCJavaArtifact) { targets << "roborio" // Debug can be overridden by command line, for use with VSCode debug = getDebugOrDefault(false) } } }

// Defining my dependencies. In this case, WPILib (+ friends), CTRE Toolsuite (Talon SRX) // and NavX. dependencies { compile wpilib() compile ctre() compile navx() }

// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') // in order to make them all available at runtime. Also adding the manifest so WPILib // knows where to look for our Robot Class. jar { from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_CLASS) }

// Force Java 8 Compatibility mode for deployed code, in case the develoment // system is using Java 10. compileJava { sourceCompatibility = 1.8 targetCompatibility = 1.8 }

wrapper { gradleVersion = '4.9' }

ThadHouse commented 6 years ago

The failure you're seeing is happening long before the build actually gets called. Its happening just trying to initialize the build system. From a command line, what shows up if you run java -version. Also where is your JAVA_HOME variable pointing to?

cfernan62 commented 6 years ago

C:\Users\clfernandez>java -version java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) Client VM (build 25.161-b12, mixed mode, sharing)

C:\Users\clfernandez>echo %JAVA_HOME% "C:\Program Files (x86)\Java\jre1.8.0_161"

AustinShalit commented 6 years ago

Where are you running the build (are you at home or at a work or school?)?

AustinShalit commented 6 years ago

Can you go to your web browser and try to download this file: https://services.gradle.org/distributions/gradle-4.9-bin.zip

cfernan62 commented 6 years ago

Where are you running the build (are you at home or at a work or school?)?

I have tried running from work and home with same result.

cfernan62 commented 6 years ago

Can you go to your web browser and try to download this file: https://services.gradle.org/distributions/gradle-4.9-bin.zip

I have downloaded this zip file and manually installed gradle, setting GRADLE_HOME environment variable. Here's what I get when I verify:

C:\Users\clfernandez\Documents\Team5900 Laptop\Conbot> gradle -v


Gradle 4.10.2

Build time: 2018-09-19 18:10:15 UTC Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL: 1.0-rc-6 Kotlin: 1.2.61 Groovy: 2.4.15 Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018 JVM: 1.8.0_161 (Oracle Corporation 25.161-b12) OS: Windows 10 10.0 x86

cfernan62 commented 6 years ago

Added some echo statements to my gradlew.bat file. It breaks on this statement after echo ...init4

"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

contents of gradlew.bat file:

@if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ##########################################################################

@rem Set local scope for the variables with windows NT shell echo ...Executing gradlew.bat if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% echo ...1 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS=

@rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome echo ...2 set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 echo ...3 if "%ERRORLEVEL%" == "0" goto init

echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation.

goto fail echo ...4 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation.

goto fail

:init echo ...init @rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args

:win9xME_args echo ...init1 @rem Slurp the command line arguments. set CMD_LINE_ARGS= set _SKIP=2

:win9xME_args_slurp echo ...init2 if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*

:execute echo ...init3 @rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle echo ...init4 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% echo ...init5 :end @rem End local scope for the variables with windows NT shell if "%ERRORLEVEL%"=="0" goto mainEnd

:fail rem Set variable GRADLE_EXIT_CONSOLE if you need the script return code instead of rem the cmd.exe /c return code!

echo ...fail if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 exit /b 1

:mainEnd if "%OS%"=="Windows_NT" endlocal

:omega

cfernan62 commented 6 years ago

Thanks Thad and Austin for your help! The problem was due to firewall setting with Zscaler app. Once I disabled, I was able to build and also deploy.