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

0
8 comments

Why not mark the resource folder as a source folder, and add . to the Resource Patterns in the compiler settings?

0
Avatar
Permanently deleted user

Erik Pragt wrote:

Why not mark the resource folder as a source folder, and add . to the Resource Patterns in the compiler settings?

Because all files would get copied from all other source folders too I'd
imagine...
N.

0

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.

0
Avatar
Permanently deleted user

Correct. It seems to me IDEA is missing some basic functionality here.

0
Avatar
Permanently deleted user

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?

0
Avatar
Permanently deleted user

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?

0
Avatar
Permanently deleted user

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

0
Avatar
Permanently deleted user

That's what I'm doing right now, but it's cumbersome. IDEA should have first-class support for resource directories.

0

Please sign in to leave a comment.