gradle based project and code style

Answered

Currently we have a gradle build where we've customized the gradle project to generate an idea project that includes our preferred code styles and inspection preferences.  I would like to achieve the same result by simply opening the build.gradle file instead.

We never chekin the idea project, we just use the gradle project as the build definition. Right now developers checkout a project, run 'gradle idea' and then open the resulting customized idea project file.  Ideally, they should be able to checkout the project and just open the build.gradle file, but when they do so they get whatever local default customization properties applied to the project which has proven inconvenient to keep chasing down.

Can anyone suggest a way to configure the project to avoid this problem?

 

Thanks - Guy

 

5 comments
Comment actions Permalink

Consider using EditorConfig, IntelliJ IDEA supports it.

0
Comment actions Permalink

That seems like a very small subset of options, I was rather hoping for a way of injecting a whole tree of existing xml properties into the generated idea project - basically what I currently do when I run `gradle idea` but have it run automatically when the gradle file is imported into a project.

 

 

 

0
Comment actions Permalink

We solved custom configuration by manipulating (extending) the iml XML using the Gradle IDEA plugin and it works just fine. Extracting parts that are shared between different modules to separate Gradle files is the way to go to not clutter your build scripts with to much customization.

0
Comment actions Permalink

but doesn't this require using gradle to build the intellij projects, which is what I'm doing right now.  If I just open the gradle file it doesn't seem to inherit any of the intellij customization from the idea task in the build script.

Am I missing something?

0
Comment actions Permalink

IntelliJ Gradle integration doesn't support manipulating (extending) the iml XML using the gradle 'idea' plugin, since the result of such manipulation hasn't been exposed by gradle tooling api which is used by IntelliJ

0

Please sign in to leave a comment.