そのため、現在、Android プロジェクト用の ant ビルド/パブリッシング スクリプトを新しい Android Gradle ビルド システムに移行する作業を行っています。
私たちのプロジェクトは通常、内部ライブラリとサードパーティ ライブラリの両方に依存しています。内部ライブラリは Artifactory リポジトリで公開されており、現在、それらの依存関係を解決するのに苦労しています。
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
maven{
url 'http://dl.bintray.com/jfrog/jfrog-jars'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.1.0')
}
}
apply plugin: 'android'
apply plugin: 'artifactory'
artifactory {
contextUrl = 'my_artifactory_url'
resolve {
repository {
repoKey = 'libs-snapshot'
maven = true
}
}
}
dependencies {
compile files('libs/android-support-v4.jar')
compile(group: 'groupId', name: 'artifact1Id', version: 'artifact1Version')
compile(group: 'groupId', name: 'artifact2Id', version: 'artifact2Version')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
基本的に Artifactory の組み込みオプションを使用して、artifactory{} セクションと 2 つの compile() 行を生成しました。しかし、ビルドしようとするとこのエラーが発生します(そして、私が試した小さな変更が何であれ、それを続けています):
15:34:23.208 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:34:23.209 [ERROR] [org.gradle.BuildExceptionReporter]
15:34:23.210 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:34:23.210 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred configuring project ':GradleArtifactoryTest'.
15:34:23.210 [ERROR] [org.gradle.BuildExceptionReporter] > Failed to notify project evaluation listener.
15:34:23.211 [ERROR] [org.gradle.BuildExceptionReporter] > Could not resolve all dependencies for configuration ':GradleArtifactoryTest:compile'.
15:34:23.211 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find groupId:artifact1Id:artifact1Version.
15:34:23.212 [ERROR] [org.gradle.BuildExceptionReporter] Required by:
15:34:23.212 [ERROR] [org.gradle.BuildExceptionReporter] workspace_gradle-artifactory-test:GradleArtifactoryTest:unspecified
15:34:23.213 [ERROR] [org.gradle.BuildExceptionReporter] > Could not find groupId:artifact2Id:artifact2Version.
15:34:23.213 [ERROR] [org.gradle.BuildExceptionReporter] Required by:
15:34:23.214 [ERROR] [org.gradle.BuildExceptionReporter] workspace_gradle-artifactory-test:GradleArtifactoryTest:unspecified
何か大きなものを見逃しているのかもしれませんが、Gradle、Maven、Artifactory の新参者として、今のところちょっと迷っています。誰かが私を啓発したり、問題に関するより正確な情報を取得する方法を教えてくれたりできますか ( --debug と --info、 --s と --S オプションを試しましたが、あまり役に立ちませんでした)。最初の例外は常に次のとおりです。
Caused by: org.gradle.api.internal.artifacts.ivyservice.ModuleVersionNotFoundException: Could not find groupId:artifact1Id:artifact1Version.
Required by:
14:20:51.833 [ERROR] [org.gradle.BuildExceptionReporter] workspace_gradle-artifactory-test:GradleArtifactoryTest:unspecified
14:20:51.833 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$StaticVersionResolveResult.notFound(LazyDependencyToModuleResolver.java:148)
14:20:51.834 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.LazyDependencyToModuleResolver$AbstractVersionResolveResult.resolve(LazyDependencyToModuleResolver.java:89)
14:20:51.834 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$ModuleVersionSelectorResolveState.resolve(DependencyGraphBuilder.java:943)
14:20:51.835 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DefaultModuleRevisionResolveState.getMetaData(DependencyGraphBuilder.java:648)
14:20:51.835 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.calculateTargetConfigurations(DependencyGraphBuilder.java:333)
14:20:51.836 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder$DependencyEdge.attachToTargetConfigurations(DependencyGraphBuilder.java:309)
14:20:51.836 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.traverseGraph(DependencyGraphBuilder.java:130)
14:20:51.836 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder.resolve(DependencyGraphBuilder.java:66)
14:20:51.837 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.artifacts.ivyservice.resolveengine.DefaultDependencyResolver.resolve(DefaultDependencyResolver.java:7
「gradle refresh-dependencies --info」コマンドは、より有用な情報を提供しませんでした。ただし、非常に厄介なのは、デバッグ トレースに、私が提供した contextUrl がまったく記載されていないことです。代わりに、次のものを取得しました(これは、私が持つべきものではないと思います):
selecting new module version groupId#artifact1Id;artifact1Version
16:58:08.827 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.ivyresolve.UserResolverChain] Attempting to resolve module 'groupId:artifact1Id:artifact1Version' using repositories [maven, maven2]
16:58:08.829 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Loading /Applications/Android Studio.app/sdk/extras/android/m2repository/groupId/artifact1Id/artifact1version/artifact1Id-artifact1Version.pom
16:58:08.832 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Resource not reachable for groupId#artifact1Id;artifact1Version: res=MissingResource: /Applications/Android Studio.app/sdk/extras/android/m2repository/groupId/artifact1Id/artifact1version/artifact1Id-artifact1Version.pom
16:58:08.833 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Loading /Applications/Android Studio.app/sdk/extras/android/m2repository/groupId/artifact1Id/artifact1version/artifact1Id-artifact1Version.apklib
16:58:08.840 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver] Resource not reachable for groupId#artifact1Id;artifact1Version: res=MissingResource: /Applications/Android Studio.app/sdk/extras/android/m2repository/groupId/artifact1Id/artifact1version/artifact1Id-artifact1Version.apklib