Eclipse Pluging: Adding Resource Filters

(bart.spedden) #1

Is there a way to have eclipse ignore the build directory?

In eclipse I can manually add them by going to Project Properties -> Resource -> Resource Filter and then adding a filter to exclude the build directory. I haven’t found how to this via the documentation, the forum, or google.


(Peter Niederwieser) #2

To my knowledge, Gradle’s Eclipse plugin can’t set resource filters. The future of Eclipse tooling is the Eclipse Gradle plugin (part of SpringSource Tool Suite), which might already set such a filter. If not, it would make a good feature request.

(Rolf Suurd) #3

You will have to manually manipulate the eclipse project file generated in your build:

eclipse {
 project {
  file {
   withXml { xmlProvider ->
    Node project = xmlProvider.asNode()
          Node filter = project.appendNode('filteredResources').appendNode('filter')
      filter.appendNode('id', 2889034)
     filter.appendNode('name', 'build filter')
    filter.appendNode('type', 10)
      Node matcher = filter.appendNode('matcher')
    matcher.appendNode('id', 'org.eclipse.ui.ide.multiFilter')
    matcher.appendNode('arguments', '1.0-name-matches-false-false-build')

(bart.spedden) #4

Thanks Rolf, this definitely gets me heading the correct direction. Your solution works perfectly from the command line. I’m seeing some issues when importing a project with subprojects via the sts gradle plugin that I believe is related to the cleanEclipse call, but I’m not sure yet. i’ll keep digging and report back when I get this resolved.