Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to prevent IntelliJ IDEA from compiling logback.groovy?

I have a groovy project in IntelliJ IDEA that uses logback.groovy. It's in src/main/resources so that it ends up in the classpath of the project, but IDEA compiles it into logback.class. Logback expects this to be in .groovy format, so this won't do. Is there a way to prevent this behavior? I just want logback.groovy in my classpath for running unit tests and webapp debugging.

like image 474
Joe Avatar asked Oct 25 '25 02:10

Joe


1 Answers

IDEA 13 now supports new types of directory assignments under your content root: the relevant one for this question is "resources". In previous versions, IDEA only supported marking directories as "sources" or "tests".

So the new correct answer is to mark src/main/resources directory as a resources folder of your content root. By marking the contents of a directory as "resources", you're telling IDEA that the contents are not source code but need to be accessible on the classpath at runtime.

[Added as a separate answer because the first one is still potentially useful if your file is stuck under your source tree for whatever reason - feel free to merge it in to the other answer if that's more appropriate.]

like image 159
Shorn Avatar answered Oct 27 '25 01:10

Shorn