2

I created a new simple maven project. I was following the project structure found here, however, it doesn't state where to place .js, .sql, .html, .css, .jsp files. Where do I place static client side files such as these in my maven project?


Here is the project structure that I have now:

enter image description here


EDIT:

Also, this question is different from the one posted as a duplicated since my question involves general static files whereas the other question involves specific files like javascript. Please reopen.

robben
  • 181
  • 3
  • 13
  • I thought such things went into the webapp directory as appropriate. – KevinO May 23 '17 at 19:43
  • @KevinO That is where I have it now i.e under webapp. However, not sure of the naming conventions for the static files. If it does indeed need to be under webapp, do I create additional folders named html, javascript, css, etc? – robben May 23 '17 at 19:45
  • 1
    Well, we have `index.jsp` directly under `src/main/webapp`. There are directories for `css`, and `.css` files are there (and properly referenced in the includes). Part of the structure depends upon other things -- such as do you use a filter for 'secure' pages and have them under `/secure/SOMEPAGE.jsp`? – KevinO May 23 '17 at 19:48
  • @KevinO Nope, nothing like secure. It is a very basic project – robben May 23 '17 at 20:07
  • Well, nonetheless, separating some things, like .css is a good practice, so those can go in a `css` subdirectory. EDIT: also things like the web.xml go in the webapp directory. – KevinO May 23 '17 at 20:10
  • 1
    Possible duplicate of [What are the conventional locations for for JSPs, JavaScript, CSS, Images in Maven web projects?](https://stackoverflow.com/questions/5542382/what-are-the-conventional-locations-for-for-jsps-javascript-css-images-in-mav) – Michael Peacock May 23 '17 at 20:16
  • @MichaelPeacock Similar question but it's not a duplicate. Also, that question is six years old. – robben May 24 '17 at 13:08

1 Answers1

4

If you are using WAR packaging, in webapp. If you are using JAR packaging, in resources.

EDIT: the .sql files should go always in resources

Mario
  • 1,661
  • 13
  • 22