adding/updating debug configurations from gradle build file



One of the ways I think we could help get developers up to speed on new projects is by automatically generating the required run/debug configurations in IDEA when they open the project. 

The only thing I've seen do this properly is the gradle ratpack plugin.

I've experimented with idea.iws.withXml, but you only seem to be able to modify the legacy .iws and .ipr files, rather than the new storage format under .idea/. 

Currently I'm doing:

tasks.withType(GeneratorTask).all { GeneratorTask generatorTask ->
if (name.contentEquals("ideaWorkspace")) {
// use JDOM to rewrite ./idea/workspace.xml

Is there a canonical way of doing this?

Better, is there a way of hooking into IDEA somehow to maybe run a script, like in the "IDE Scripting" tool?





So far, there is no canonical way for doing this, so your approach look reasonable while IDEA-174087 is not implemented


Thanks for confirming that. My approach works, but it runs too often... on any gradle run. I would like it to run only when idea reimports the gradle config, as the current "idea {}" block seems to.

Until the above issue is implemented, I think a simple gradle plugin that supported only run configs would be useful... if no one else from the community wants to have a crack at it I will...


Please sign in to leave a comment.