我最近将我的 github 项目上传到 bintray 并成功将其与 JCenter 存储库同步。我使用了本教程:
http://inthecheesefactory.com/blog/how-to-upload-library-to-jcenter-maven-central-as-dependency/en
所以我的gradle依赖是:
dependencies {
compile 'com.github.danylo2006:hashtag-helper:1.1.0'
}
为了上传它,我修改了我的 build.gradle 并添加了相关的脚本和平。一切都像教程中的一样。
... some code here
ext {
bintrayRepo = 'maven'
bintrayName = 'hashtag-helper'
publishedGroupId = 'com.github.danylo2006'
libraryName = 'HashTagHelper'
artifact = 'hashtag-helper'
libraryDescription = 'This is a library designed for highlighting hashtags ("#example") and catching click on them.'
siteUrl = 'https://github.com/danylo2006/HashTagHelper'
gitUrl = 'https://github.com/danylo2006/HashTagHelper.git'
libraryVersion = '1.1.0'
developerId = 'danylovolokh'
developerName = 'Danylo Volokh'
developerEmail = 'v.danylo@gmail.com'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
这是棘手的部分:
我已将我的 github 昵称danylo2006更改为danylovolokh,现在我想更改 gradle 依赖项:
dependencies {
compile 'com.github.danylo2006:hashtag-helper:1.1.0'
}
改成:
dependencies {
compile 'com.github.danylovolokh:hashtag-helper:1.1.0'
}
- 我从 Sonatype 获得了我需要的 groupId
- 所以我修改了我的 gradle 脚本。
唯一相关的变化是:
publishedGroupId = 'com.github.danylo2006'
已改为
publishedGroupId = 'com.github.danylovolokh'
我运行相关命令: gradlew install gradlew bintrayUpload
我得到了 BUILD_SUCCESSFULL
但是,如果我向任何其他 gradle 项目添加新的依赖项,我会收到“错误:(36, 13) 无法解决:com.github.danylovolokh:hashtag-helper:1.1.0”的错误