eclipseClasspath { withXml { xmlProvider -> def classpath = xmlProvider.asNode() def parser = new XmlParser() classpath.classpathentry.findAll{ entry -> entry.@kind == 'var' && configurations.runtime.find {entry.@path.endsWith(it.name) && !entry.@path.contains('servlet-api') }.each { entry -> def attrs = entry.attributes ?: parser.createNode(entry, 'attributes', [:]) parser.createNode(attrs, 'attribute', [name: 'org.eclipse.jst.component.dependency', value: '../']) } } }