简体   繁体   中英

Files duplicated after manually renaming

Using Intellij, Springboot.

When I rename the files in a directory manually(Intellij->refactor->rename) and restart my web application, when I walk in that directory I can see the renamed files are duplicated (there now is both old name and new name in my app) What am I missing?!

my directory is under /resources/my_dir

File myDirectory = new ClassPathResource(MY_DIR).getFile();
    try (Stream<Path> paths = Files.walk(queryDirectory.toPath())) {
        paths.filter(Files::isRegularFile).forEach(path -> setFile(path));
    }

I'll assume here, that you are talking about files in the directory of compiled files. The reason is that only the source files are renamed when renaming something like an XML file in the resources folder, or whatever the case may be.

That, however is not in any way tied to the target directory. Build tools, like maven, or I assume the compiler intellij uses copies everything it can't compile to that target directory.

What you have to do is clean the project and build again, so that the target directory is "clean"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM