Gradle build doesn't download dependencies

前端 未结 5 1442
暖寄归人
暖寄归人 2020-12-14 09:52

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.

5条回答
  •  不知归路
    2020-12-14 10:14

    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) })

提交回复
热议问题