问题添加依赖android studio

时间:2015-01-14 18:38:55

标签: maven dependencies artifactory

我在Artifactory

中发布了我的图书馆

https://imagizer.imageshack.us/v2/806x253q90/631/kkK1Yn.png

这是我的Gradle

buildscript {
repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
    classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle',    
    version: '3.0.1')
    }
}

repositories {
    jcenter()
    mavenCentral()
    mavenLocal()
    maven {
       url 'http://myartifactory:8081/artifactory/gradle-local'
    }
}

apply plugin: 'com.jfrog.artifactory'
apply plugin: 'com.android.library'
apply plugin: 'android-apt'
def AAVersion = '3.2'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

sourceSets {
    main {
    }

}

dependencies {
   compile fileTree(include: ['*.jar', '*.so'], dir: 'libs')
   compile 'com.android.support:recyclerview-v7:21.0.+'
   compile 'com.android.support:appcompat-v7:21.0.+'
   compile 'com.android.support:support-v4:21.0.+'
   compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
   compile 'de.greenrobot:eventbus:2.4.0'
   compile 'com.github.chrisbanes.photoview:library:1.2.3'
   compile 'it.sephiroth.android.exif:library:+'
   compile 'com.joanzapata.android:android-iconify:1.0.8'
   compile 'com.android.support:cardview-v7:21.0.+'
   compile 'com.afollestad:material-dialogs:0.6.0'
   compile 'com.github.lzyzsd:circleprogress:1.0.1@aar'
   apt "org.androidannotations:androidannotations:$AAVersion"
   compile "org.androidannotations:androidannotations-api:$AAVersion"
   compile(group: 'com.mylibrary.android.common', name: 'android.common', version: '1.0.0', ext: 'aar')
}
apt {
   arguments {
      androidManifestFile variant.outputs[0].processResources.manifestFile

      resourcePackageName 'com.mypackage.library'


   }
}

我收到此错误

https://imagizer.imageshack.us/v2/519x72q90/540/8ojerK.png

Gradle我发现使用url错误地使用“/”代替“。”

运行路由

尝试找到

... 8081 / artifactory的/回购/ COM / mypackage的/机器人/普通/ android.common / 1.0.0 / android.common-1.0.0.aar

但应该是

... 8081 / artifactory的/回购/ com.mypackage.android.common / android.common / 1.0.0 / android.common-1.0.0.aar

我做错了,错在发表于artefactory

1 个答案:

答案 0 :(得分:1)

您的工件不符合标准Maven布局,其中groupId应由/分隔,而不是.

这不是什么大问题,Gradle可以轻松处理它,你只是不能将存储库声明为maven,而是将ivy声明为。{/ p>

实际上,使用the artifactory plugin进行分辨会更容易,它也支持Maven和Ivy布局。

另外,请记住设置repository in Artifactory to be with correct layout(不是Maven2,可能是常春藤)。

坦率地说,我认为值得在Maven布局下重新部署工件,它会让你的生活更轻松。