Gradle (still) does not find junit

Using an unmodifed jersey starter app (https://github.com/jasonray/jersey-starterkit), I am unable to get junit downloaded using any of the suggestions found elsewhere, including using

sourceSets.main.java.srcDirs = ["src"]
sourceSets.test.java.srcDirs = ["tst"]

in build.gradle.

The project builds successfully using ./gradlew build, but ./gradlew dependencies (and eclipse) show FAILED for junit:junit-dep:4.10

Any ideas?

The default build.gradle:

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'war'
  repositories {
    mavenCentral()
}
  dependencies {
    compile "javax.ws.rs:jsr311-api:1.1.1"
        compile 'com.sun.jersey:jersey-server:1.16'
    compile 'com.sun.jersey:jersey-core:1.16'
    compile 'com.sun.jersey:jersey-client:1.16'
    compile 'com.sun.jersey:jersey-servlet:1.16'
    compile 'com.sun.jersey:jersey-json:1.16'
          compile 'com.yammer.metrics:metrics-core:2.2.0'
    compile 'com.yammer.metrics:metrics-servlet:2.2.0'
    compile 'com.yammer.metrics:metrics-jersey:2.2.0'
    compile 'com.yammer.metrics:metrics-graphite:2.2.0'
          compile 'log4j:log4j:1.2.16'
      testCompile "junit:junit-dep:4.10"
}
  task wrapper(type: Wrapper) {
    gradleVersion = '1.11'
}

There is nothing wrong with, or missing from, this build script. ‘gradle dependencies’ works fine for me (also with 1.11) and shows no errors. Perhaps some proxy or network issue on your side?

I ended up using the jersey tutorial with Maven, so I didn’t actually get this working. Junit was the only dependency that wasn’t downloaded, so I’m not sure what the issue was. Didn’t seem network related. I’m on MacOS 10.10 and these tools generally can get at whatever remote resources they need.

It’s working for me too (Windows).

Do you have a ~/.m2/settings.xml that could be conflicting?

Did you try deleting your ~/.gradle cache and downloading again?

Is this the tutorial you followed for Maven? https://jersey.java.net/documentation/latest/getting-started.html