Gradle + Eclipse plugin: Remove build folder from Eclipse project

By default Eclipse plugin does not add /build folder into ignored resources and that may cause /build folder to be validated. Then many warnings will appear in Markers tab of Eclipse. Beside that it may be performance problem.

I found almost suitable solution here: Unfortunately it adds new filter into configuration during each ‘gradle eclipse’. Here is my fix for that situation:

eclipse.project.file.withXml { xmlProvider -> 
    Node project = xmlProvider.asNode() 
    Node node = project 
    if (node.filteredResources.isEmpty()) { 
        node = node.appendNode('filteredResources') 
    } else { 
        node = node.filteredResources[0] 
    if (!node.filter.any {[0].value()[0]=='1447321705713'}) { 
        Node filter = node.appendNode('filter') 
        filter.appendNode('id', '1447321705713') 
        filter.appendNode('name', '') 
        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') 

So filter node is added only in case it does not already exists.

Last blog articles:
Hello Ruby: Dobrodružné programování
Edison EdBlocks: Using remote control
Edison 2.0 received!
JS debug: visually compare two objects or JSONs in browser
4 tips to return multiple values

Last tweets: