Monday, July 6, 2015

IntelliJ Gradle not resolving dependencies

Followed the typical process of setting up a simple Gradle project in IntelliJ  IDEA 14 ....but dependencies were not resolving.  Upon hitting the refresh button, each of the gradle dependencies were underlined red....no useful feedback in logs or console.

I eventually figured out the problem:  Intellij was configured for Gradle offline mode.

Preferences >> Build, Execution & Deployment > Build Tools > Gradle >> Offline Work

Global Gradle Settings was set to 'Offline Work'.  I have no idea why, may have been due to a sketchy WI-FI connection I was using.

After unchecking the box and refreshing the Gradle project, I'm back on track.

I found it very useful to download and install Gradle for the command line (using gvm)  so I could test Gradle independent of IntelliJ.  I had no problems using command line gradle to download dependencies....telling me the problem was with IDEA.

It was also helpful to run Gradle tasks (like compileJavaTest) directly using IntelliJ.  While, 'Refresh' produces no useful console output, running Gradle tasks do.... and in this case the error told me the problem was 'Offline Mode'.


2 comments: