{
Resource<?> resource = resourceFactory.create(getClass().getResource(
SCAFFOLD_DIR + scaffoldResource.getSource()));
if (project.hasFacet(TemplateFacet.class))
{
TemplateFacet templates = project.getFacet(TemplateFacet.class);
Resource<?> templateResource = templates.getResource(scaffoldResource.getSource());
if (templateResource.exists())
{
resource = templateResource;
}
}