IntelliJ IDEA Gradle + Groovy

gradle, groovy, intellij-idea, java, maven

Solution

I would suggest not creating the project from inside Intellij.

Since Intellij imports Gradle projects quite nicely you can just import one of the pre-made Groovy Gradle Quick Starts you can find at the root of your Gradle installation.

For example `$GRADLE_HOME/samples/groovy/mixedJavaAndGroovy` has the exact Java/Groovy layout you describe with the HelloWorld Classes and Tests in place. Just copy it, rename the root folder, import it into Intellij and code!

Problem

I am new to IDEA. What I would like to do is have a project (or module?) that has maven folder structure (aka src/main/java, src/main/groovy, src/test/groovy, etc), be managed by Gradle and support creation of Groovy classes, their compilation and execution. What I tried: - Create a "Groovy" Project. - I can add "Maven" support, but not Gradle. - Create a "Gradle" project and add "Groovy" module to it - I can manage dependencies and plugins, but the file structure is screwed up. - The code goes into a sub-folder of the project (aka the name of the module) - I cannot directly add folders to the "src" of the module. When I copy them into the src folder they are considered package names. What I am looking for: - Solution to the particular problem - General workflow for creating multi-facet (aka Gradle+Groovy or Java+Maven or Web+YouNameIt) project/modules. - Explanation of what is the reason for this paradigm/structure shift in IDEA?

Original source