简体   繁体   English

为android build.gradle文件添加额外的maven存储库不起作用

[英]Adding additional maven repositories for android build.gradle file is not working

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.0.0'
    }
}

allprojects {
    repositories {
        jcenter()
    }
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.0.2"

    defaultConfig {
        applicationId "com.sample.app"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

apply plugin: 'maven'
repositories {
    maven {
        url "http://mycompany.com/nexus/content/repositories/mobile/Android/common/rest-api/1.0/"
        artifactUrls "http://mycompany.com/nexus/content/repositories/mobile"
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'Android.myApp:rest-api:1.0'
}

above the build.gradle file. 在build.gradle文件之上。 When I execute gradle tasks I'm getting 当我执行gradle任务时,我得到了

A problem occurred configuring root project 'app'. 配置根项目“app”时出现问题。

Could not resolve all dependencies for configuration ':_debugCompile'. 无法解析配置':_debugCompile'的所有依赖项。 Could not resolve Android.myApp:rest-api:1.0. 无法解析Android.myApp:rest-api:1.0。 Required by: :app:unspecified Target host must not be null, or set in parameters. 要求:: app:未指定目标主机不能为空,或者在参数中设置。

confirmed pom files and jar files are present in the maven repo. 确认的pom文件和jar文件存在于maven仓库中。

Its silly. 它很傻。

maven {
    url 'http:////mycompany.app.com/nexus/content/repositories/mobile'
}

url should contain 4 //// after http. 在http之后,url应该包含4 ////。 We are using nexus and this fixes the issue. 我们正在使用nexus,这解决了这个问题。

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

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