2013-11-22 3 views
3

Я пытаюсь создать андроидную библиотеку (MyLib1), которая зависит от другой андроидной библиотеки (MyLib2) в градиенте и дженкинсе. Я немного отчаялся, потому что я думаю, что мои файлы и настройки градиентов в порядке.Gradle не смог разрешить зависимость от artifactory

Я успешно опубликовал первую андроид-библиотеку для artifactory. В Artifactory, я вижу объявление следующей зависимости:

compile(group: 'MyGroup', name: 'MyLib1', version: '1.0', ext: 'aar') 

Я вставил эту декларацию зависимостей в мой secound build.gradle:

buildscript { 
    repositories { 
    maven { url "http://localhost:8081/artifactory/myvirtualrepository" } 
    } 
    dependencies { 
    classpath 'com.android.tools.build:gradle:0.6.+' 
    classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.2.0') 
    } 
} 
(...) 
dependencies { 
    compile (group: 'MyGroup', name: 'MyLib1', version: '1.0', ext: 'aar') 
    (...) 
} 

Но Gradle не может найти андроид-библиотеки (MyLib1)? Я получаю следующую ошибку:

* What went wrong: 
15:50:50.110 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring root project 'workspace'. 
15:50:50.111 [ERROR] [org.gradle.BuildExceptionReporter] > Failed to notify project evaluation listener. 
15:50:50.111 [ERROR] [org.gradle.BuildExceptionReporter] > Could not resolve all dependencies for configuration ':_DebugCompile'. 
15:50:50.112 [ERROR] [org.gradle.BuildExceptionReporter]  > Could not find MyGroup:MyLib1:1.0. 
15:50:50.113 [ERROR] [org.gradle.BuildExceptionReporter]   Required by: 
15:50:50.113 [ERROR] [org.gradle.BuildExceptionReporter]    MyGroup:workspace:1.0 

Как я могу решить проблему с моей андроидной библиотекой? Есть ли способ «отлаживать» зависимости?

Примечание: "MyGroup" является частью от "myvirtualrepository"

Edit: трассировка от virtualrepository

Request ID: 8c181328 
Repo Path ID: myvirtualrepository:mygroup/mylib1/1.0/mylib1-1.0.aar 
Method Name: GET 
User: admin 
Time: 2013-11-24T18:05:26.079+01:00 
Thread: http-bio-8081-exec-8 
Steps: 
2013-11-24T18:05:26.079+01:00 Received request 
2013-11-24T18:05:26.079+01:00 Request source = 0:0:0:0:0:0:0:1, Last modified = 01-01-70 00:59:59 CET, If modified since = -1, Thread name = http-bio-8081-exec-8 
2013-11-24T18:05:26.079+01:00 Executing any BeforeDownloadRequest user plugins that may exist 
2013-11-24T18:05:26.079+01:00 Retrieving info 
2013-11-24T18:05:26.079+01:00 Consulting the virtual repo download strategy 
2013-11-24T18:05:26.079+01:00 Trying to retrieve resource info from the local storage 
2013-11-24T18:05:26.080+01:00 Unable to find resource in myvirtualrepository:mygroup/mylib1/1.0/mylib1-1.0.aar 
2013-11-24T18:05:26.080+01:00 Searching for info in aggregated repositories 
2013-11-24T18:05:26.080+01:00 Preparing list of aggregated repositories to search in 
2013-11-24T18:05:26.081+01:00 Appending the virtual repository 'myvirtualrepository' 
2013-11-24T18:05:26.081+01:00 Appending the virtual repository 'myvirtualrepository' 
2013-11-24T18:05:26.081+01:00 Appending the virtual repository 'myvirtualrepository' 
2013-11-24T18:05:26.081+01:00 Appending collective local repositories 
2013-11-24T18:05:26.081+01:00 Appending collective local cache repositories 
2013-11-24T18:05:26.081+01:00 Appending collective remote repositories 
2013-11-24T18:05:26.081+01:00 Intercepting info request with 'PomInterceptor' 
2013-11-24T18:05:26.082+01:00 Intercepting info request with 'MavenMetadataInterceptor' 
2013-11-24T18:05:26.082+01:00 Processing request as a release resource 
2013-11-24T18:05:26.082+01:00 Searching for the resource within mylocalrepository 
2013-11-24T18:05:26.085+01:00 Resource was found in mylocalrepository 
2013-11-24T18:05:26.085+01:00 Resource is an exact match - returning 
2013-11-24T18:05:26.085+01:00 Returning resource as found in the aggregated repositories 
2013-11-24T18:05:26.086+01:00 Intercepting found resource with 'PomInterceptor' 
2013-11-24T18:05:26.086+01:00 Intercepting found resource with 'MavenMetadataInterceptor' 
2013-11-24T18:05:26.086+01:00 Requested resource is found = true 
2013-11-24T18:05:26.086+01:00 Request is HEAD = false 
2013-11-24T18:05:26.086+01:00 Request is for a checksum = false 
2013-11-24T18:05:26.086+01:00 Target repository is not remote or doesn't store locally = true 
2013-11-24T18:05:26.086+01:00 Requested resource was not modified = false 
2013-11-24T18:05:26.086+01:00 Responding with found resource 
2013-11-24T18:05:26.086+01:00 Executing any AltResponse user plugins that may exist 
2013-11-24T18:05:26.086+01:00 Alternative response status is set to -1 and message to 'null' 
2013-11-24T18:05:26.086+01:00 Found no alternative content handles 
2013-11-24T18:05:26.086+01:00 Retrieving a content handle from target repo 
2013-11-24T18:05:26.086+01:00 The requested resource isn't pre-resolved 
2013-11-24T18:05:26.086+01:00 Target repository isn't virtual - verifying that downloading is allowed 
2013-11-24T18:05:26.086+01:00 Creating a resource handle from 'mylocalrepository:mygroup/mylib1/1.0/mylib1-1.0.aar' 
2013-11-24T18:05:26.087+01:00 Identified requested resource as a file 
2013-11-24T18:05:26.087+01:00 Requested resource is an ordinary artifact - using normal content handle with length '1614343' 
2013-11-24T18:05:26.087+01:00 Executing any BeforeDownload user plugins that may exist 
2013-11-24T18:05:26.087+01:00 Responding with selected content handle 
2013-11-24T18:05:26.087+01:00 Request succeeded 

команды след от localrepository

Request ID: f782a19f 
Repo Path ID: mylocalrepository:mygroup/mylib1/1.0/mylib1-1.0.aar 
Method Name: GET 
User: anonymous 
Time: 2013-11-25T14:53:09.336+01:00 
Thread: http-bio-8081-exec-2 
Steps: 
2013-11-25T14:53:09.336+01:00 Received request 
2013-11-25T14:53:09.336+01:00 Request source = 0:0:0:0:0:0:0:1, Last modified = 01-01-70 00:59:59 CET, If modified since = -1, Thread name = http-bio-8081-exec-2 
2013-11-25T14:53:09.336+01:00 Executing any BeforeDownloadRequest user plugins that may exist 
2013-11-25T14:53:09.336+01:00 Retrieving info 
2013-11-25T14:53:09.340+01:00 Requested resource is found = true 
2013-11-25T14:53:09.340+01:00 Request is HEAD = false 
2013-11-25T14:53:09.340+01:00 Request is for a checksum = false 
2013-11-25T14:53:09.341+01:00 Target repository is not remote or doesn't store locally = true 
2013-11-25T14:53:09.341+01:00 Requested resource was not modified = false 
2013-11-25T14:53:09.341+01:00 Responding with found resource 
2013-11-25T14:53:09.341+01:00 Executing any AltResponse user plugins that may exist 
2013-11-25T14:53:09.341+01:00 Alternative response status is set to -1 and message to 'null' 
2013-11-25T14:53:09.341+01:00 Found no alternative content handles 
2013-11-25T14:53:09.341+01:00 Retrieving a content handle from target repo 
2013-11-25T14:53:09.341+01:00 The requested resource isn't pre-resolved 
2013-11-25T14:53:09.341+01:00 Target repository isn't virtual - verifying that downloading is allowed 
2013-11-25T14:53:09.341+01:00 Creating a resource handle from 'mylocalrepository:mygroup/mylib1/1.0/mylib1-1.0.aar' 
2013-11-25T14:53:09.342+01:00 Identified requested resource as a file 
2013-11-25T14:53:09.342+01:00 Requested resource is an ordinary artifact - using normal content handle with length '1614343' 
2013-11-25T14:53:09.343+01:00 Executing any BeforeDownload user plugins that may exist 
2013-11-25T14:53:09.343+01:00 Responding with selected content handle 
2013-11-25T14:53:09.343+01:00 Request succeeded 

Спасибо :)

ответ

5

Существует простой способ отладить разрешение Artifactory - the trace command.

В вашем случае вы должны запустить http://localhost:8081/artifactory/myvirtualrepository/MyGroup/MyLib1/1.0/MyLib1-1.0.jar?trace

Выход на straighforward, но если вам нужна дополнительная помощь, вы можете добавить вывод на вопрос и мы решим это.

Итак, в отношении вашего следа - это показывает, что артефакт найден и успешно загружен. Вы можете загрузить артефакт из виртуального репо с помощью своего браузера? Просмотр по http://localhost:8081/artifactory/myvirtualrepository/MyGroup/MyLib1/1.0/MyLib1-1.0.aar?

А как насчет местного репо (http://localhost:8081/artifactory/mylocalrepository/MyGroup/MyLib1/1.0/MyLib1-1.0.aar)?

+0

Спасибо за помощь, я добавил вывод команды trace на мой вопрос. – sbo

+0

Да, я могу загрузить библиотеку как из локального, так и виртуального репо. Я также добавил вывод трассировки из локального репозитория. – sbo

+2

Итак, это подключение Gradle к Artifactory. Может ли это быть какой-то прокси? Другой способ: использовать плагин Artifactory Gradle (http://www.jfrog.com/confluence/display/RTF/Gradle+1.6+Publishing+Artifactory+Plugin), возможно, вам повезет больше, чем с обычным резонатором Maven. – JBaruch

Смежные вопросы