[forge-dev] Adding "other" files

Brian Leathem bleathem at gmail.com
Sun Apr 3 03:04:20 EDT 2011


On 04/02/2011 09:24 PM, Brian Leathem wrote:
> I have a few static files I want to add to the project (facelet files).
>
> Any pointers to where I should be looking to achieve this would be 
> appreciated...
>
> Brian

FYI: solved this as follows:

         DirectoryResource webRoot = 
project.getFacet(WebResourceFacet.class).getWebRootDirectory();
         DirectoryResource templateDirectory = 
webRoot.getOrCreateChildDirectory("templates");
         FileResource<?> templatePage = (FileResource<?>) 
templateDirectory.getChild("template.xhtml");
         InputStream stream = 
RichFacesPlugin.class.getResourceAsStream("/org/richfaces/forge/template.xhtml");
         templatePage.setContents(stream);
         pipeOut.println(ShellColor.YELLOW, 
String.format(SUCCESS_MSG_FMT, "template.xhtml", "file"));

Brian


More information about the forge-dev mailing list