Gradle eclipse silently fails if jar cannot be loaded

gradle eclipse silently fails if its dependency fails to load from a 404. Here’s my build.gradle

apply plugin: 'java'
apply plugin: 'eclipse'

repositories { 
  mavenCentral()
}

dependencies {
  compile 'com.sun.media:jai_imageio:1.1'
}

jai_core-1.1.3.jar happens to be missing from http://repo1.maven.org/maven2/javax/media/jai_core/1.1.3

gradle eclipse says successful

$ gradle eclipse
:eclipseClasspath
:eclipseJdt
:eclipseProject
:eclipse

BUILD SUCCESSFUL

Total time: 2.406 secs

This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.7/userguide/gradle_daemon.html

Yet the produced .classpath doesn’t have jai_imageio

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="output" path="bin"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
</classpath>

Running gradle --debug eclipse reveals

16:52:25.474 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Sending request: GET /maven2/javax/media/jai_core/1.1.3/jai_core-1.1.3.jar HTTP/1.1
16:52:25.523 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Receiving response: HTTP/1.1 404 Not Found
16:52:25.523 [DEBUG] [org.apache.http.impl.client.SystemDefaultHttpClient] Connection can be kept alive indefinitely
16:52:25.524 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection [id: 0][route: {s}->https://repo1.maven.org] can be kept alive indefinitely
16:52:25.529 [DEBUG] [org.apache.http.impl.conn.PoolingClientConnectionManager] Connection released: [id: 0][route: {s}->https://repo1.maven.org][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 10]
16:52:25.537 [INFO] [org.gradle.internal.resource.transport.http.HttpClientHelper] Resource missing. [HTTP GET: https://repo1.maven.org/maven2/javax/media/jai_core/1.1.3/jai_core-1.1.3.jar]
16:52:25.537 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository] Downloaded artifact 'jai_core.jar (javax.media:jai_core:1.1.3)' from resolver: MavenRepo

Note Receiving response: HTTP/1.1 404 Not Found

I observed this with Gradle 2.6 and 2.7.

Thanks, this is GRADLE-1945

The idea being that we want the IDE plugins to do as much as they can (even if they can’t resolve all dependencies) so you can try to fix the project once it’s imported. It would be convenient if we’d at least warn when we cannot resolve dependencies.