Hello,
I’m new to using Gradle and when running ./gradlew
I’m getting this error:
Could not resolve all dependencies for configuration ‘:testCompileClasspath’.
Could not resolve junit:junit:4.11.
Required by:
project :
Could not resolve junit:junit:4.11.
org.apache.http.conn.ssl.SSLConnectionSocketFactory.(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V
Here’s my build.gradle:
apply plugin: ‘java’
apply plugin: ‘jacoco’
group ‘assign2’
allprojects {
repositories {
mavenCentral()
//maven { url "file:/Library/Java/Extensions }
}
}
dependencies {
testCompile group: ‘junit’, name: ‘junit’, version: “4.12”
//testCompile files(‘./junit-4.12.jar’)
}
buildscript {
repositories {
mavenCentral()
}
}
repositories {
mavenCentral()
//maven { url "file:/Library/Java/Extensions }
}
compileJava {
options.compilerArgs << “-Xlint:unchecked” << “-Xlint:deprecation”
}
compileTestJava {
options.compilerArgs << “-Xlint:unchecked” << “-Xlint:deprecation”
}
sourceSets.main.java.srcDirs = [‘AirportCodes/src’]
sourceSets.test.java.srcDirs = [‘AirportCodes/test’]
jacocoTestReport {
doFirst{
classDirectories = fileTree(
dir: ‘./build/classes/main/app’,
excludes: [‘**/ui/*.class’]
)
}
reports {
xml.enabled false
csv.enabled false
html.destination “build/reports/coverageHtml”
}
}
defaultTasks ‘clean’, ‘test’, ‘jacocoTestReport’
I’ve tried a multitude of solutions and it looks like the connection to the Maven repo is being blocked. However, I have turned off my firewall and have disabled all proxies. I’m using OS X 10.11 with Java 1.8.0_121. I am able to access the repo through my browser.
The only way I can get a clean run with no errors is to include the jar files in the project directory and point to them in the gradle.build file.
An even stranger thing is that this same exact Gradle project runs fine on two other machines. My machine is the only one experiencing the problem.
I’d really appreciate any help I can get on this issue.
Thanks!