What’s the recommended location for SQL, DDL, … scripts in the Maven standard directory structure?
I bet almost every web project uses a DB and some kind of SQL scripts that need to be stored somewhere, so what would probably be the “best” place where to keep these files?
Please advise.
I think there is no best practice for this. In my past project, I created a separate directory for storing such SQL script.
For example
src/main/db.It won’t be packaged to final JAR by default (which are the preferred way in most case), yet it is convenient enough to let it packaged in assembly. You can even package them in the main artifact JAR, by adding corresponding resource declaration or using maven build-helper plugin.
However, all depends on your usage on this script. My simple “rule of thumb” is that, I would consider putting them in
resources/only when they are really resources to be loaded by the application.