I have run into the same issue and I am aware of the problem of partially compiled class files. But on the other hand, having different output folders can be a much greater pain.
For example in the case when you did a gradle build, resources are copied to the output folder. When you do open resource (str-shift-r) in eclipse after the gradle build you will get both the resource file in the build directory as well as the resource file in the source directory. This can lead to very annoying situations, where you loose your latest changes.
Would it be possible to add a flag to the gradle eclipse target, which will configure the same output directories for eclipse as for gradle.
For the mean time we created a hack which configures the output folders for the java directory
Map<String, String> pathMappings = [:];
SourceSetContainer sourceSets = project.sourceSets;
sourceSets.each { SourceSet sourceSet ->
String relativeJavaOutputDirectory = project.relativePath(sourceSet.output.classesDir);
String relativeResourceOutputDirectory = project.relativePath(sourceSet.output.resourcesDir);
sourceSet.java.getSrcDirTrees().each { DirectoryTree sourceDirectory ->
String relativeSrcPath = project.relativePath(sourceDirectory.dir.absolutePath);
pathMappings[relativeSrcPath] = relativeJavaOutputDirectory;
}
sourceSet.resources.getSrcDirTrees().each { DirectoryTree resourceDirectory ->
String relativeResourcePath = project.relativePath(resourceDirectory.dir.absolutePath);
pathMappings[relativeResourcePath] = relativeResourceOutputDirectory;
}
}
project.eclipse.classpath.file {
whenMerged { classpath ->
classpath.entries.findAll { entry ->
return entry.kind == ‘src’;
}.each { entry ->
if(pathMappings.containsKey(entry.path)) {
entry.output = pathMappings[entry.path];
}
}
}
}
After looking at a place where this flag could be integrated I would assume the best place would be on Line 74 in org.gradle.plugins.ide.eclipse.model.internal.SourceFoldersCreator. I could also help and provide a patch with the changes needed.