简体   繁体   English

Gradle只从Maven Central下载.aar.asc

[英]Gradle only downloads .aar.asc from Maven Central

I freshly deployed an Android library named TypedPreferences . 我刚刚部署了一个名为TypedPreferences的Android库。 I used it in another Android project for some days. 我在其他Android项目中使用它已有几天了。 Suddenly, it stopped working - dependencies cannot be found any longer. 突然间,它停止了工作 - 再也找不到依赖关系了 I noticed that Gradle only downloads one file when I clean the project: 我注意到Gradle在清理项目时只下载了一个文件:

Download http://repo1.maven.org/maven2/info/metadude/android/typed-preferences/ \
  1.0.0/typed-preferences-1.0.0.aar.asc

These are build files of my pet project: 这些是我的宠物项目的构建文件:

build.gradle : build.gradle

// Top-level build file where you can add configuration 
// options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.8.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
        maven {
            url "${System.env.HOME}/.m2/repository"
        }
        maven {
            url "https://github.com/novoda/public-mvn-repo/raw/master/releases"
        }
    }
}

app/build.gradle : app/build.gradle

apply plugin: 'android'
apply plugin: 'idea'

idea {
    module {
        downloadJavadoc = true
        downloadSources = true
    }
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.0.+'
    compile 'com.android.support:appcompat-v7:19.0.+'
    compile 'com.squareup.okhttp:okhttp:1.3.+'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.2.+'
    compile 'com.fasterxml.jackson.core:jackson-core:2.2.+'
    compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.+'
    compile 'com.novoda:sqliteprovider-core:1.0.+'
    compile 'com.androidmapsextensions:android-maps-extensions:2.1.+'
    compile 'com.google.android.gms:play-services:3.2.+'
    compile 'info.metadude.android:typed-preferences:1.0.0'
}

As you can see, I also enable Gradle to look into my local Maven cache here: 如您所见,我还允许Gradle在此处查看我的本地Maven缓存:

maven {
    url "${System.env.HOME}/.m2/repository"
}

I deleted the relevant folders to avoid Gradle loading stuff from there. 我删除了相关的文件夹以避免Gradle从那里加载东西。

There might be a misconfiguration in the build.gradle files of the library - please find them here: 库中的build.gradle文件可能存在配置错误 - 请在此处找到它们:

Please tell me also whether I can test your fix locally without deploying to Maven Central. 请告诉我是否可以在不部署到Maven Central的情况下在本地测试您的修复程序。

Looks like the packaging element of the published POM has the wrong value. 看起来已发布的POM的packaging元素具有错误的值。 It should be aar , not aar.asc . 它应该是aar ,而不是aar.asc

Also, you always can force the type of artifact to download. 此外,您始终可以强制下载工件类型。 Just add dependency like: 只需添加依赖项:

compile "group:artifact:version@type"

And in your case it will be 在你的情况下,它将是

compile "info.metadude.android:typed-preferences:1.0.0@aar"

That's it. 而已。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM