Non existing directories added to Eclipse classpath

Hi, I am generating Eclipse configuration from Gradle v1.0 and it often adds non existing directories to Eclipse classpath.

For example my project does not have any tests and project/build/classes/tests and project/build/resources/tests directories are not being created. However these directories are added to Eclipse and it complains about not existing directories in classpath.

The configuration of Eclipse is based on what’s configured in the build (e.g. by the ‘java’ plugin), not on which files/directories exist at the time that the Eclipse project is generated. This was considered the lesser evil than, say, having to regenerate the Eclipse project every time you add the first test file to a subproject. Maybe there is a way to improve on that, for example by creating empty directories. Which exact message do you get in Eclipse? Is it a warning, error, etc?

Eclipse gives build path error. Specifically it writes the following: Project ‘Test’ is missing required source folder: ‘src/test/java’

The project cannot be built until build path errors are resolved

Since output directories (i.e. build…) are also added to classpath their absence also triggers the same error.

I actually already wrote a task that creates all the directories, but it has to be manually updated for each sourceset which is inconvenient. Is there a better way to write it? Better yet can be a part of eclipse plugin?

eclipseClasspath.doLast {
  eclipse.classpath.sourceSets.main.allSource.each { it.mkdirs() }
  eclipse.classpath.sourceSets.main.output.each { it.mkdirs() }
  eclipse.classpath.sourceSets.test.output.each { it.mkdirs() }

Scannotation is throwing RuntimeExceptions for the same reason when classpath scanning:

Gradle test > STANDARD_ERROR

java.lang.RuntimeException: File in java.class.path does not exist: /Users/petrovic/Projects/xoom/qa/prod/common/page-object/platform/build/resources/main

at org.scannotation.ClasspathUrlFinder.findClassPaths(

where there is no such actual runtime path as build/resources/main.