Directory with resources dir ending on ".lib" not copied into "target/classes" when IDEA builds automatically.
I have the following project layout:
- project
- project-app
- project-lib
- src
- main
- java
- […]
- resources
- foo.bar.project.lib
- file1.yaml
- file2.yaml
- foo.bar.project.lib
- java
- main
- target
- classes
- src
- project-war
When I execute `mvn clean`, the `target` directory gets removed and a few seconds later IDEA re-creates it because it builds the project. Though, after IDEA finished, the resource directory `foo.bar.project.lib` is NOT placed into `target/classes`. What I need to get the resources there is to run `mvn compile` or something.
I've tested why IDEA behaves that way by adding additional files and directories into `resources` and found that only the directories ending in `.lib` are ignored. Though, I didn't test with files being named such way, because I don't need it. Doesn't matte, as soon as I rename `foo.bar.project.lib` to e.g. `foo.bar.project.lib_`, IDEA happily copies the resources when it auto-builds. A name like `foo.bar.project-lib` works as well.
Why does IDEA behave that way? How can I disable that, preferrably in `pom.xml`?
I'm using the most current version:
Build #IU-251.23774.435, built on April 14, 2025
Please sign in to leave a comment.
IntelliJ IDEA seems to ignore resource directories ending in .lib during its automatic builds, preventing them from being copied to target/classes until a mvn compile is run. While renaming the directory (e.g., to foo.bar.project_lib) resolves this in IDEA, a pom.xml solution for consistent builds is preferable. You can achieve this by explicitly configuring resource inclusion for src/main/resources/foo.bar.project.lib in your pom.xml's <build><resources> section, specifying the directory and target path, while potentially excluding it from the main resources directory definition. Alternatively, you could configure IDEA's resource folders directly, but this is IDE-specific. Ultimately, renaming the directory is often the simplest and most robust fix for IDEA's behavior.
centura health login
Do you know the reason why IDEA behaves that way? I couldn't find any setting or something. Strange behaviour in my opinion.
Update: The user registered for this answer only, the name looks strange and the answer pretty much reads like my observation as a fact only, without any additional context. Though, my question was explicitly about reasons, settings etc. Looks to me like this is some AI-genrated stuff.
Update 2: It is spam, there was a link added in the bottom of the answer. :-)
Hello, Thorsten!
Thank you for reporting this!
That does not look like an intended behavior to me.
I've reproduced this behavior, created a YouTrack Issue IDEA-372848 for it and assigned it to the developers to have it investigated and resolved.
Further updates will be posted on YouTrack.