Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What gradle task pulls dependencies from remote repositories?

I am making the switch to Gradle for my Android project. I have imported the project into Android Studio from Eclipse and have wrapped it using Gradle 1.8.

My assumption was Gradle handled dependencies the way as Maven, that is if you specify a dependency that does not exist in your local repository it will pull it from the remote repository. Android Studio is not pulling in my dependencies. I attempted to run ./gradlew androidDependencies --debug but I do not see any downloading of the dependencies however they are being acknowledged they are there and no warnings/errors are thrown.

11:11:36.833 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleVersionRepository] Using cached module metadata for module 'com.nostra13.universalimageloader#parent;1.8.6' in 'MavenRepo'
11:11:36.834 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain] Using module 'com.nostra13.universalimageloader:parent:1.8.6' from repository 'MavenRepo'
11:11:36.855 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting configuration com.nostra13.universalimageloader:parent:1.8.6(default).
11:11:36.857 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Attaching com.nostra13.universalimageloader:parent:1.8.6(default) to its parents.

Gradle does take the dependency and create metadata from it in this location

/home/wil/.gradle/caches/artifacts-26/filestore/com.nostra13.universalimageloader/parent/1.8.6/pom/41669498c2bec505b61772b083cab341653cb86b

Interestingly I have found that if I have the maven dependencies locally it will pull it into Android Studio as an External Library and it will also add the jar to the gradle cache filestore it will just not do this for remote dependencies I specifiy.

Here is my build.gradle

buildscript {
repositories {
    maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
    classpath 'com.android.tools.build:gradle:0.6.3'
}
}
repositories{
    mavenCentral()
}
apply plugin: 'android'

dependencies {
    compile 'com.nostra13.universalimageloader:parent:1.8.6'
}

android {
compileSdkVersion 19
buildToolsVersion "19"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 17
}
sourceSets {
    main {
        manifest.srcFile 'AndroidManifest.xml'
        java.srcDirs = ['src']
        resources.srcDirs = ['src']
        aidl.srcDirs = ['src']
        renderscript.srcDirs = ['src']
        res.srcDirs = ['res']
        assets.srcDirs = ['assets']
    }
    instrumentTest.setRoot('tests')
    debug.setRoot('build-types/debug')
    release.setRoot('build-types/release')
}
}

I am running Android Studio 0.3.6, Ubuntu 13.04, Gradle 1.8, JDK 6

What gradle command should I run that should pull down remote dependencies from a maven repository? Am I missing a configuration setting somewhere that allows downloading of dependencies?

like image 560
wi1 Avatar asked Nov 26 '13 16:11

wi1


1 Answers

By using gradle dependencies command line, you can pull down all everything specified in your build.gradle

like image 194
yunspace Avatar answered Nov 07 '22 08:11

yunspace