IntelliJ + groovy DSL: How to exclude files from being compiled by groovy plugin?

Doron Gold

I am working on a Java web project that uses Liquibase groovy DSL to managae DB changes. For the sake of this topic, it could be any other 3rd party library that uses *.groovy files as sources. The project is built with gradle. In one of my modules (dao-base) under the src/main/resources folder I have groovy files (changelog01.groovy, master_changelog.groovy etc.). these files should be loaded by the liquibase jar at runtime.

Now when I try to make the project in IntelliJ it gives the following error message:

Groovyc: Cannot compile Groovy files: no Groovy library is defined for module 'dao-base'.

I understood that the groovy plugin detects *.groovy files, tries to compile them and unsurprisingly fails. these are groovy DSL files that should be loaded only by the 3rd party liquibase parser and I don't need IntelliJ's groovy plugin to try and compile them.

I managed to come up with 2 partial solutions: 1. disabling groovy plugin in intellij. The problem with this solution is that the gradle plugin depends on the groovy plugin and thus is automatically disabled when disabling the groovy plugin. I need the gradle plugin enabled. 2. excluding the src/main/resources folder in project settings --> modules --> dao-base (my module) --> sources tab. The problem with this solution is that when I build the project and deploy to tomcat, the files from the resources folder are missing and since the files in it are required in runtime, I get file not found exception when the war loads.

I was hoping someone could come up with a better solution for this problem.

Anton Arhipov

Try removing the groovy file suffix from the compiler's resources list:

Settings -> Compiler

IntelliJ IDEA Compiler Settings

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I exclude a certain groovy file from being compiled in gradle?

From Dev

Intellij exclude file from being compiled

From Dev

how to include groovy dsl script from one groovy file to another

From Dev

Exclude files from being concatenated (MINIT plugin)

From Dev

Intellij differentiate java from groovy files

From Dev

How to use closures of Jenkins Job DSL Plugin within groovy classes

From Dev

how to exclude typescript compiled files from git

From Dev

How to copy files in Groovy

From Dev

How can I in Gulp exclude javascript files compiled from Typescript?

From Dev

Groovy DSL: How to hide closure parameter?

From Dev

Runtime error upon running compiled Groovy code in IntelliJ IDEA 13

From Dev

How to use RTC plugin from jenkins pipeline groovy script?

From Dev

How to exclude a string in groovy using regex?

From Dev

Implementing DSL Whitelist in Groovy

From Dev

Groovy DSL with Java

From Dev

How to exclude files from being published in ASP.NET Core?

From Dev

How to exclude some files from being copied using xcopy?

From Dev

How to change Eclipse-Groovy plugin Groovy libraries?

From Dev

How to exclude css files from auto formatting in IntelliJ

From Dev

How to merge 2 groovy configuration files which are in the form of groovy scripts?

From Dev

How to merge 2 groovy configuration files which are in the form of groovy scripts?

From Dev

How to break from groovy 'eachFileMatch()'

From Dev

How to define a prototype scoped bean in Groovy spring DSL

From Dev

Grails: How to know which command is being executed, from BuildConfig.groovy

From Dev

Grails: How to know which command is being executed, from BuildConfig.groovy

From Dev

Copy files from one folder to another with Groovy

From Dev

Groovy - Reading files from tomcat server

From Dev

groovy dsl - is infix operator possible?

From Dev

IntelliJ + Groovy + Spock

Related Related

  1. 1

    How do I exclude a certain groovy file from being compiled in gradle?

  2. 2

    Intellij exclude file from being compiled

  3. 3

    how to include groovy dsl script from one groovy file to another

  4. 4

    Exclude files from being concatenated (MINIT plugin)

  5. 5

    Intellij differentiate java from groovy files

  6. 6

    How to use closures of Jenkins Job DSL Plugin within groovy classes

  7. 7

    how to exclude typescript compiled files from git

  8. 8

    How to copy files in Groovy

  9. 9

    How can I in Gulp exclude javascript files compiled from Typescript?

  10. 10

    Groovy DSL: How to hide closure parameter?

  11. 11

    Runtime error upon running compiled Groovy code in IntelliJ IDEA 13

  12. 12

    How to use RTC plugin from jenkins pipeline groovy script?

  13. 13

    How to exclude a string in groovy using regex?

  14. 14

    Implementing DSL Whitelist in Groovy

  15. 15

    Groovy DSL with Java

  16. 16

    How to exclude files from being published in ASP.NET Core?

  17. 17

    How to exclude some files from being copied using xcopy?

  18. 18

    How to change Eclipse-Groovy plugin Groovy libraries?

  19. 19

    How to exclude css files from auto formatting in IntelliJ

  20. 20

    How to merge 2 groovy configuration files which are in the form of groovy scripts?

  21. 21

    How to merge 2 groovy configuration files which are in the form of groovy scripts?

  22. 22

    How to break from groovy 'eachFileMatch()'

  23. 23

    How to define a prototype scoped bean in Groovy spring DSL

  24. 24

    Grails: How to know which command is being executed, from BuildConfig.groovy

  25. 25

    Grails: How to know which command is being executed, from BuildConfig.groovy

  26. 26

    Copy files from one folder to another with Groovy

  27. 27

    Groovy - Reading files from tomcat server

  28. 28

    groovy dsl - is infix operator possible?

  29. 29

    IntelliJ + Groovy + Spock

HotTag

Archive