How to get IDEA not to compile groovy scripts?

Answered

I have a lot of groovy scripts in my test/resources directory that IDEA wants to compile by default.  I load these dynamically for unit tests and there are copies of the same class in them for testing purposes, so compilation fails.  I can remove the test resource directory as source via the project settings, but every time I re-import my pom the change gets blown away.  Is there a way to do prevent these scripts from being compiled that will preserve a project reimport from the pom?

Daniel

0
5 comments

Settings -> Compiler -> Excludes :-)

0

Wonderful.  Thanks very much!

Daniel

0

This doesn't appear to work in IntelliJ IDEA 2022.3.1 (Ultimate Edition). I excluded my resource path but the IDE still displays compilation errors for my *.groovy files.

0

Gbrown These are likely syntax/inspection issues detected on the fly, not the compilation problems. If you don't want IDE to inspect your Groovy files, either set the highlighting level to None in the top right corner of the editor per file, or assign *.groovy extension to Text file type. Or you can disable Groovy plug-in and use basic highlighting provided by TextMate bundles (Settings (Preferences on macOS) | Editor | TextMate Bundles).

1

Serge Baranov Thank you for the prompt and informative response!

 

0

Please sign in to leave a comment.