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

Hi,

I have added two linked resources to my eclipse project file and I want to configure my deployment assembly to point to these two linked resources.

The following code sets up the linkedResource to the absolute path of the folders :

eclipse.project {    
    linkedResource name: 'project-java', type: '2', location: "$rootDir/project/src/main/java"
    linkedResource name: 'project-resources', type: '2', location: "$rootDir/project/src/main/resources"
}

I’ve tried adding these as source paths for wb-resource, however exectuing “gradle eclipseWtp” does not add the wb-resources. I believe this is because the source path is not found and as per the documentation will not be added.

eclipse.wtp.component { 
        // Required to preserve web app resource                 
        resource deployPath: '/', sourcePath: project.webAppDirName        
        resource deployPath: '/WEB-INF/classes', sourcePath: "/project-java"
        resource deployPath: '/', sourcePath: "/project-resources"                            
}

If however I change the source path to use an absolute path, the wb-resources appear in my org.elicpse.wst.common.component file.

eclipse.wtp.component { 
        // Required to preserve web app resource                 
        resource deployPath: '/', sourcePath: project.webAppDirName        
        resource deployPath: '/WEB-INF/classes', sourcePath: "$rootDir/project/src/main/java"
        resource deployPath: '/', sourcePath: "$rootDir/project/src/main/resources"                            
}

The problem at this point is that I get a validation error when I open the deployment assembly saying :
‘Cannot find entry: “D:/checkouts/project/src/main/java”.’

I’ve searched through the suggested similar topics and only found one unanswered topic.

Does anyone have a suggestion how to get the plugin to add these linked resources as entries to the wb-resources?

Thanks,
Ferg

I would also be very interested in an answer to this!

Hi,

Giving my own thread a bump to see if anyone could even point me in the right direction for an answer. Currently with the way my solution works, it requires a manual step after the cleanEclipse eclipse has run which isn’t very useful.

Thanks in advance,
Ferg

I’ve worked around this same issue with the following… using the XML hook to manually add it in…

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