Reputation: 31
I've read a lot of things on the Internet about packaging JSF2 composite component in a JAR file.
Does somebody know where I can find what MUST be the structure of JAR (specs, official doc, etc, ). Is there a way to do it with Netbeans IDE, or does an archetype exist for Maven ?
Upvotes: 3
Views: 1731
Reputation: 1108642
From the JSF composite
tag library documentation summary (emphasis mine):
Creating a Composite Component
The default implementation must support authoring. A composite component is declared by creating a Facelets2 file inside of a resource library. (See section JSF.2.6 of the specification prose document for more information about resource libraries.) A composite component must reside within a resource library. It is not possible to create a composite component without putting it inside of a resource library.
From section 2.6 of the JSF specification:
2.6.1.2 Packaging Resources into the Classpath
For the default implementation, resources packaged in the classpath must reside under the JAR entry name:
META-INF/resources/<resourceIdentifier>
Resources packaged into the classpath must be accessed using the
getResource*()
methods of theClassLoader
obtained by calling thegetContextClassLoader()
method of the currentThread
.
To the point, all composite components must go into /META-INF/resources
folder of the JAR. It's to be treated the same way as /WEB-INF/resources
in the regular WAR (so you still need an extra subfolder to represent the composite compnent's main namespace).
For the case that, if the JAR also contains classes with JSF annotations like @ManagedBean
and such, then the JAR must also have a JSF 2.0 compatible /META-INF/faces-config.xml
file in order to trigger the JSF annotation scanner to crawl the entire JAR for classes implementing any of the JSF annotations.
As to the Netbeans/Maven part, sorry I have no idea as I don't use them.
Upvotes: 4