I've finally solved a nagging eclipse configuration issue with developing Sling 
JSP's and I wanted to share with the community.

One of the pain points we've always found was the lack of a context root in a 
bundle package.  That's the ability to reference a file in JSP  via an include 
to another file in your code and have it resolve to the correct path. We've 
tried various tricks over the last couple of years and none of them really were 
as smooth or integrated as we'd like. Turns out, that at some point M2E 
integration started supporting the web-fragment facet/specification. We 
included a web-fragment.xml that looked like this at our root under 
/src/main/content/jcr_root

<web-fragment id="WebFragment_ID" version="3.0"
                xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
                xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd";>
                <display-name>web.content.foo</display-name>
                <name>web_content_foo</name>
</web-fragment>

It then added an additional .settings file that sets a list of roots defined by 
the resource paths in your maven file.

-Jason

Reply via email to