1

I started using Gradle/Intellij for some android playtime. The concept seems good, and I like the idea of being able to run the same builds outside of the IDE. So I figured I'd do the same thing with a JavaFX application under Idea-15.

Nothing makes sense anymore. I've been searching and experimenting for three days and haven't found reasonable answers to a lot of things that I think ought to be pretty obvious:

  • Should I be expecting commandline Gradle builds to be identical to IDE builds?
  • If the build results are different, does it mean I've done something wrong?
  • When I "synchronize" from the IDE's Gradle window, what am I synchronizing?
    • IE, Is it OK to manually edit the build.gradle and settings.gradle files?
    • If so, is it also OK to modify the IDE project settings?

Basically, is there a big picture of Gradle-IntelliJ synchronization that I'm not understanding here?

Update:

Added my findings below.

If anyone experienced has anything to add or modify, I'd love to hear it.

0

1 Answer 1

1

Update:

It is best to think of Intellij as using its IML to cache configuration settings from your various modules' build.gradle files. Every time you do a gradle "re-sync", you are essentially rebuilding the IML. This is why it is recommended to leave your IML out of source control.

  • Build/make from the Intellij build menu is not hooked into Gradle at all. It builds according to project settings, which it has hopefully updated from your build.gradle at the last sync. It is, however, the only way to get nice IDE integration to take you directly to your build errors from the build message window.
  • building from Intellij's Gradle tool window uses your gradlew script. This may be different from your installed gradle version.
  • Gradle clean, gradle sync, and Intellij's invalidate-and-restart are your friends.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.