Intellij 13.1: gradle + make

I have a gradle project which I've imported into intellij. Intellij creates the project layout with all the modules which is great. However, when I try to run any of the applications in the project intellij doesn't run gradle to do the builds. Instead I need to do it manually using the gradle window (gradle assemble or whatever). After that I can run the projects with intellij. However, the issue here is that my gradle builds generate source code and since IntelliJ doesn't hook gradle to do the builds when I touch the source files which are used to generate java source a build is not automatically run which is irritating to say the least

I've been using Android Studio which does actually do gradle builds using its "Gradle-aware Make", something which regular IntelliJ is missing.

Am I missing something or is this simply not supported yet?

10 comments
Comment actions Permalink

IDEA uses own compiler infrastructure for build actions with fast incremental compilation, hot code swap etc.  
Gradle build tasks invocation instead of IDEA's is not supported yet, you can watch and/or vote for the feature at https://youtrack.jetbrains.com/issue/IDEA-131627

0
Comment actions Permalink

Is there a way to automatically trigger gradle builds when a file is touched? That would solve the problem for me.

0
Comment actions Permalink

it seems you are looking for an option to plug into the project import to specify your task for execution after the import in a combination with gradle autoimport option.
Autoimport is already implemented (see gradle settings "use auto-import") but extention of the import is only planned for future versions (https://youtrack.jetbrains.com/issue/IDEA-125930)

0
Comment actions Permalink

No, I'm looking for a way to trigger a gradle build when a file is touched :)

For example, consider a gradle task which runs antlr to generate a set of java source files. When I touch the .antlr file I'd like gradle generateAntlrSource to be automatically run. With eclipse this was pretty straightforward. How can I do so with IntelliJ?

0
Comment actions Permalink

Could you point me where can I find this in eclipse?

0
Comment actions Permalink

We created ant builder as described here:

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2FgettingStarted%2Fqs-93_project_builder.htm

In the project settings you select the builders used, so we selected the ant builder followed by the java builder. Something like:

http://mobilepearls.com/labs/ndk-builder-in-eclipse/configure-builders.png

The builder settings would also look for changes in the source files used to generate code and trigger on that.

0
Comment actions Permalink

I'm not aware of a way to trigger something before IDE project "make" in IntelliJ without creating additional plugin, sorry.
This is only planned for Gradle plugin - an ability to run a task Before/After Make and other IDE build actions. Something similar that was done for maven projects (see screenshot attached for illustration).
This should do the job with enabled automake feature.



Attachment(s):
testMavenPr.png
0
Comment actions Permalink

That would sort my problem out for sure. When will that be available?

0
Comment actions Permalink

The feature planned for IDEA 14.1 release (~ in the first quarter of 2015).

0
Comment actions Permalink

I see that 14 was released. Was anything improved in this area in the 14.0 release?

0

Please sign in to leave a comment.