Maven and JSF webapp structure, where exactly to put JSF resources

JSF resources which are to be referenced by <h:outputStylesheet>, <h:outputScript> and <h:graphicImage> (thus, CSS/JS/images), should end up in /resources folder of the public webcontent, there where the /WEB-INF and /META-INF folders also are.

Thus, you’ve to put them in /src/main/webapp/resources.

src
 `-- main
      |-- java
      |-- resources
      `-- webapp
           |-- resources
           |    |-- css
           |    |    `-- style.css
           |    |-- images
           |    |    `-- logo.png
           |    `-- js
           |         `-- script.js
           |-- WEB-INF 
           |    `-- web.xml
           `-- index.xhtml

Those i18n files (I assume you technically meant resource bundle files) have ultimately to end up in a package in /WEB-INF/classes. The /src/main/resources is intented for non-class files which are supposed to end up in /WEB-INF/classes, you should put them in there. Assuming a bundle base name of com.example.i18n.text, provide them as such:

src
 `-- main
      |-- java
      |-- resources
      |    `-- com
      |         `-- example
      |              `-- i18n
      |                   |-- text.properties
      |                   |-- text_en.properties
      |                   |-- text_es.properties
      |                   `-- text_nl.properties
      :                   

See also:

Leave a Comment