How to copy resources to output folder
I need to copy all files within some folder (say src/resources) to the compiler output folder, no matter what their name/extension is. Can I do this with compiler resource patterns, or is there another way to achieve this? (It would be great if I could just mark a folder in the module settings as "Resources" - just as for sources, test sources, and ignored files.)
Cheers,
Peter
请先登录再写评论。
Why not mark the resource folder as a source folder, and add . to the Resource Patterns in the compiler settings?
Erik Pragt wrote:
Because all files would get copied from all other source folders too I'd
imagine...
N.
Or create small Ant script which does that, than in Run/Debug
Configuration dialog select:
Before launch -> Run Ant target
If you have separate Ant build script, you can reuse this Ant script too.
Correct. It seems to me IDEA is missing some basic functionality here.
Maybe what you are really wanting to do is add the directory to the classpath?
If you give a little more details exactly what you are trying to do maybe more help can be provided. I have never had a problem with intelliJ being unable to copy needed resource files to the appropriate place, maybe the way you are doing something is odd and you just need to change to a more conventional way maybe?
We have a Maven directory layout, so everything under src/main/resources needs to be on the classpath and in the resulting jar. How to accomplish this when running tests/building jars with IDEA?
you can set src/main/sources as a source folder, and make sure all resource types you use are declared as resources in the compiler settings
That's what I'm doing right now, but it's cumbersome. IDEA should have first-class support for resource directories.