Maven uploadArchives(aar)到GitLab Maven Repository

时间:2014-04-04 02:49:47

标签: android maven gradle gitlab

我正在使用gradle生成Android Library Archive(aar),现在想直接部署到Git Maven Repo。我已成功将其生成到本地文件系统,但是当我尝试直接部署到GitLab repo时出现问题。

请注意,GitLab存储库是公共的,一旦我生成Android库存档(aar)到本地git位置(文件系统)并推送它,我可以在其他Android项目中添加依赖项,它可以正常工作。

的build.gradle

apply plugin: 'android-library'
apply plugin: 'android-maven'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
        classpath 'com.github.dcendents:android-maven-plugin:1.0'

        //for using HTTP url obtained from GitLab
        classpath 'org.apache.maven.wagon:wagon-http:2.2'
    }
}
install {
    repositories.mavenInstaller {
        pom.groupId = 'com.company.android'
        pom.artifactId = 'androidcommons'
        pom.version = '0.1.1'
    }
}

uploadArchives {
    repositories {
        mavenDeployer {

            //HTTP url obtained GitLab
            repository(url: "http://beans.infra.company.com/<group>/<project>/raw/maven-repo/releases/")

            pom.groupId = 'com.company.android'
            pom.artifactId = 'androidcommons'

            pom.version = '0.1.1'
        }
    }
}

当我运行gradle clean install uploadArchives时,我收到此错误:

Error deploying artifact: Resource to deploy not found: File: http://beans.infra.company.com/<group>/<project>/raw/maven-repo/releases/com/company/android/androidcommons/0.1.1/androidcommons-0.1.1.aar does not exist

在我看来,存储库URL被视为File而不是HTTP url。我查看gradle docs并且唯一可用的信息是我需要在依赖项中包含'org.apache.maven.wagon:wagon-http:2.2'以被视为HTTP而不是File,我已经是。在这方面的任何帮助将不胜感激。

0 个答案:

没有答案