8

I am building a Java project in Intellij Idea IDE. Following is my build.gradle file:

group 'fyp_group09'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.5

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'
    compile 'log4j:log4j:1.2.17'
}

I use a proxy connection provided by school and have done the required proxy setup in the IDE. The log4j dependencies are not getting downloaded. I've refreshed the gradle project many times, but it does not download the dependencies and does not even give any error. How can I solve this problem?

RaGe
  • 22,696
  • 11
  • 72
  • 104
cnova
  • 725
  • 2
  • 9
  • 22
  • Does it by chance give you a message? There's a notification icon near the bottom right-hand corner of the window. It maybe green, yellow, or red. – ChiefTwoPencils Apr 17 '16 at 18:58
  • Yes now I saw and got the following message: `Warning:root project 'isothetic_cover': Unable to resolve additional project configuration. Details: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':compile'. Caused by: org.gradle.internal.resolve.ArtifactResolveException: Could not download log4j.jar (log4j:log4j:1.2.17): No cached version available for offline mode ` – cnova Apr 17 '16 at 19:02
  • 1
    I'm not familiar with that issue but maybe [this](http://stackoverflow.com/questions/34308889/no-cached-version-of-com-android-tools-buildgradle1-2-3-available-for-offline) will help you. – ChiefTwoPencils Apr 17 '16 at 19:06
  • 1
    Worked like a charm. Thank you :D – cnova Apr 17 '16 at 19:12

2 Answers2

17

The following trick as given here, worked well for me:

Un-check "Offline work" in File>Settings>Gradle>Global Gradle Settings

Community
  • 1
  • 1
cnova
  • 725
  • 2
  • 9
  • 22
12

We had this, worked after doing File>Invalidate Caches / Restart...

tplive
  • 687
  • 8
  • 17