I'm creating Spring MVC application with tomcat and gradle where user can upload some file from frontend and then can make changes with that. I want to upload that file to the project directory (scr/tmp/env). It works if I create directory manually, but i can't push empty packages into git. It means that when someone downloads my project to another computer, he won't have these directories inside the project. For example i can create some class with public static void method and this code:
File file = new File("src/tmp/dbEnv/");
if (!file.exists()) {
Files.createDirectories(Paths.get("src/tmp/dbEnv/"));
}
It will create directory. But if i paste this code into spring methods (in controller or dao classes for example), directories aren't created.
Could you give me advice, how to create directories in project before starting and clear those before finishing application? May be Spring or Gradle can do it? Thank you.