After running gradle build
in the root directory of my my web app, the spring security dependency declared in build.gradle
does not get downloaded.
System caches the dependent jars so it won't be downloaded again and again.
If your goal is to just see the downloads of the dependencies then you can force it to redownload.
Remove any dependency caches stored locally [1]
$ rm -rf ~/.gradle/caches/
Then restart your build
$ gradlew clean build
You could also force a dependency update with [2]
$ gradlew --refresh-dependencies
[1]https://docs.gradle.org/current/userguide/dependency_management.html#sec:dependency_cache
[2]https://docs.gradle.org/current/userguide/dependency_management.html#sub:cache_refresh
The solution that helped in my case:
File -> Invalidate Caches/Restart...
I'm using IntelliJ 2018.2.3 and Gradle was not downloading dependencies for me.
I found that I had to uncheck the 'Offline work' box in the Gradle settings to get it to download them. I'm not sure how this box became checked because I didn't check it (honest).
If your project builds successfully some time it may be gradle download problem with a current proxy. Gradle has it's own dependency management system similar to maven. I think parts of the gradle publish plugin are backed by maven in some way (not verified). Regardless you shouldn't have to worry about that level of depth, gradle will handle it. Your problem is setting up the proxy. You just need to set some variables in $projectDir/gradle.properties, for example:
#http proxy setup
systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost
This can be used to download dependencies without proxy. If you want to use a proxy for you can use the code as below instead of above code.
systemProp.https.proxyPort=3128
systemProp.http.proxyHost=192.168.16.2
systemProp.https.proxyHost=192.168.16.2
systemProp.http.proxyPort=3128
Proxy port and host can be changed as you want.
had something like this problem while was building older react-native
project.
the react-native run-android
command just did print:
Could not find com.android.tools.build:gradle:2.3.3
after lot of changes to the build.gradle
file noticed that it was okay and
just opened the android
directory of my react-native
project in Android-Studio
and all dependencies was downloaded.
but to prevent download of files again and again used GradleCopy to make them available offline and changed the build.gradle
file like below:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
//kotlin_version = '1.2.40'
offline = 'D:/android/sdk/extras/m2repository'
}
repositories {
try { maven { url uri(offline) } } catch (Throwable e) {}
try { maven { url uri('C:/Program Files/Android/Android Studio/gradle/m2repository') } } catch (Throwable e) {}
jcenter()
maven { url 'https://maven.google.com' }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' //was "2.3.3" with "gradle-3.4.1-all.zip" got "3.1.3" with "gradle-4.4-all.zip"
////below "kotlin" is required in root "build.gradle" else the "offline" repo will not get searched
//classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
try { maven { url uri(offline) } } catch (Throwable e) {}
jcenter()
mavenLocal()
maven {
url 'https://maven.google.com/'
name 'Google'
}
mavenCentral()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
(i.e. did set offline
variable to my m2repository
path and used it like: maven { url uri(offline) }
)