Idea & Eclipse plugins do not report missing dependencies


(Uriah Carpenter) #1

In the process of migrating our builds from M3 to M7 I’ve noticed that both the Eclipse and Idea plugins do not report unresolved dependencies. Because there is no default logging statement, you must inspect the generated .iml or .classpath file to find items that didn’t resolve.

For the following build file the logging output for generating the Eclipse classpath is

~master/ideagradle --> gradle eclipse

:cleanEclipseClasspath

:eclipseClasspath

:eclipse

BUILD SUCCESSFUL

However, the generated .classpath file contains

<classpathentry kind=“lib” path="/Users/uriah/Dev/java/master/ideagradle/unresolved dependency - foo#bar;1.0.0" exported=“true”>

The Idea .iml file contains

<CLASSES>

<root url=“file://$MODULE_DIR$/unresolved dependency - foo#bar;1.0.0”/>

</CLASSES>

GRADLE-1736 removed the fail fast for unresolved dependencies. I agree with not failing fast, however, an error logging message should be output for each unresolved item. Logging this error will make troubleshooting resolve problem much easier.

Trivial build file with unresolvable dependency:

apply plugin: ‘idea’

apply plugin: ‘eclipse’

apply plugin: ‘java’

repositories {

mavenCentral()

}

dependencies {

compile group: ‘javax.servlet’, name: ‘servlet-api’, version: ‘2.5’

compile group: ‘foo’, name: ‘bar’, version: ‘1.0.0’

}

sourceSets {

main {

java { srcDirs = [‘src’] }

}

}

tasks.idea {

dependsOn = [ cleanIdeaModule, ideaModule ]

}

tasks.eclipse {

dependsOn = [ cleanEclipseClasspath, eclipseClasspath ]

}


#2

Thanks for the report. I’ve added this to our issue tracker as GRADLE-2037


(Gradle Jira) #3

If Gradle fired a warning would it help?

Also sts guys might provide some nicer feedback in future so understanding the problem should be easier.


(Gradle Jira) #4

Duplicate of GRADLE-1945


(Uriah Carpenter) #5

Yes – for us simply logging a warning would be sufficient.