nus-cs2103-AY1718S1 / forum

Discussion Forum
5 stars 0 forks source link

Gradle test failure #61

Closed erik0704 closed 7 years ago

erik0704 commented 7 years ago

I follow the set up instruction and able to get the message BUILD SUCCESSFUL after running the command gradlew processResources in the console.

Using IntelliJ JUnit test runner I got all tests to passed

screen shot 10-01-17 at 10 19 pm

However when I run the Gradle test gradlew clean allTests I got a failure

FAILURE: Build failed with an exception.

screen shot 10-01-17 at 10 13 pm

Could not find tools.jar

I'm not quite sure how to resolve this.

damithc commented 7 years ago

Typically, you should start by googling the error message could not find tools.jar to see if someone else already faced/solved that problem. :-)

erik0704 commented 7 years ago

I found a fix that work for me by adding a line in the gradle.properties file

org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_45

lancehaoh commented 7 years ago

This is not the ideal solution I think. I had the same problem and I used this fix. But the extra line caused the build to fail tests on travis. I solved the issue by defining a JAVA_HOME environment variable in my computer. For mac, you have to define it in the config of the shell that you are using (you can check your shell from the command echo $SHELL). For windows, I am not sure but it can be easily googled.

erik0704 commented 7 years ago

This solution works but I also need to modifying the PATH environment variable to include %JAVA_HOME%\bin