情况
我有多个使用 JFrog Bintray 的 Android 插件。这些都位于不同的Maven存储库中。所有这些都有私有存储库,因此在解决这些依赖关系之前需要进行身份验证。有项目 A和项目 B正在内部开发,还有一个项目 C是由第三方开发的,需要将项目 B实现为依赖项,而项目 B 又依赖于项目 A。对于项目 A将有一个bintray 用户 1被授予项目 A 的权限。还会有一个bintray用户2供第三方对项目 B进行身份验证。
在项目 B中有对项目 A的依赖,如下所示:
repositories {
jcenter()
maven {
credentials {
username = 'bintrayUser1'
password = 'bintrayAPIKeyForUser1'
}
url "https://url-to-projectA"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.project:A:1.0.0'
}
现在有另一个项目 C依赖于项目 B,如下所示:
allprojects {
repositories {
jcenter()
maven {
url "https://link-to-projectB"
credentials {
username = 'bintrayUser2'
password = 'bintrayAPIKeyForUser2'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.project:B:1.0.0'
}
问题
出现的问题是要求bintray 用户 2告诉项目 C项目 A在哪里并且需要对其进行身份验证。我想知道bintray 用户 2是否可能不需要告诉Project C Project A所在的位置,而是从Project B复制它。
身份验证也是如此。有没有办法bintray 用户 2可以从项目 A的bintray 用户 1复制身份验证?
非首选解决方案
现在我可以做的是让项目 C也告诉项目 B中每个依赖项的位置,但这不能很好地扩展。这将是我将放入项目 B的每个私有依赖项,项目 C需要定位并需要对其进行身份验证。它看起来像这样:
allprojects {
repositories {
jcenter()
maven {
url "https://link-to-projectA"
credentials {
username = 'bintrayUser2'
password = 'bintrayAPIKeyForUser2'
}
}
maven {
url "https://link-to-projectB"
credentials {
username = 'bintrayUser2'
password = 'bintrayAPIKeyForUser2'
}
}
maven {
url "https://link-to-projectX"
credentials {
username = 'bintrayUser2'
password = 'bintrayAPIKeyForUser2'
}
}
maven {
url "https://link-to-projectX"
credentials {
username = 'bintrayUser2'
password = 'bintrayAPIKeyForUser2'
}
}
maven {
url "https://link-to-projectX"
credentials {
username = 'bintrayUser2'
password = 'bintrayAPIKeyForUser2'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.project:B:1.0.0'
}
这将变得难以管理,并且您可能不想授予bintray 用户 2权限。
再说一遍,有没有办法复制依赖位置和授权?