我有一个已发布到我当地Artifactory存储库的工件,现在我正试图将该工件拖入带有gradle的项目中。
但是,我一直收到以下错误:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.company.app:myapplication:1.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/company/app/...pom
https://jcenter.bintray.com/com/company/app/...jar
file:/Users/user/Library/Android/sdk/extras/android/m2repository/com/company/app...pom
file:/Users/user/Library/Android/sdk/extras/android/m2repository/com/company/app...jar
file:/Users/user/Library/Android/sdk/extras/google/m2repository/com/company/app...pom
file:/Users/user/Library/Android/sdk/extras/google/m2repository/com/company/app....jar
此错误表明它甚至没有查看本地神器存储库。以下是我的build.gradle
文件
build.gradle
buildscript {
repositories {
jcenter()
maven {
url '${artifactory_contextUrl}/libs-release-local'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.0"
}
}
allprojects {
repositories {
jcenter()
}
}
build.gradle
allprojects{
apply plugin: "com.jfrog.artifactory"
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.company.app:myapplication:1.0.0'
}
答案 0 :(得分:7)
问题是
build.gradle
以下是我当前使用的build.gradle
个文件:
build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
allprojects {
repositories {
jcenter()
}
}
build.gradle
repositories {
maven {
url '${artifactory_contextUrl}/libs-release-local'
credentials {
username = "${artifactory_user}"
password = "${artifactory_password}"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.company.app:myapplication:1.0.0'
}
注意:我删除了jfrog插件,因为只有在您发布到Artifactory时才需要它。