Can’t configure eclipse wtp component resource source path to use eclipse project linked resource

Eclipse allows linked resources to be added to a WTP deployment assembly, however this functionality is not available via configuration block as follows. It seems Gradle actively blocks it, perhaps because it cannot “see” /core as its only visible to eclipse…

eclipse.project {    
    linkedResource name: 'core', type: '2', location: 'some path somewhere...'
}

eclipse {
	wtp {
		component {
			resource sourcePath: "/core", deployPath: '/'
		}
	}
}

Expected result. As org.eclipse.wst.common.component settings file with the line

 <wb-resource deploy-path="/" source-path="/core"/>

Actual result. A org.eclipse.wst.common.component file without the /core line.

I’ve successfully worked around this issue by manually hacking the XML using the withXml hook… However this is less than ideal…

eclipse {
	wtp {
		component {
			file {
				withXml {
					def node = it.asNode().children()[0]
					node.appendNode('wb-resource', ["deploy-path": '/', "source-path": '/core-webapp'])
				}
			}
		}
	}
}
1 Like