The eclipse task does not add all src and testsrc directories to the project path. generateTestJpaMetamodelClasses is not run either.
This now works if you use the command-line 'gradle eclipse' task and then import existing projects in Eclipse.
However, it's not entirely working with Eclipse's Gradle plugin – if you import as a Gradle project and let the plugin run the 'eclipse' task, generated sources aren't always added to the classpath. This appears to be an issue with the plugin.