1. 上传流程
参考了hongyang的教程blog.csdn.net/lmj62356579…,教程相当简练,藏坑不少。
下面说我在上传的过程中需求留意的点和踩到的几个坑。
bintray-release
的优点是流程相对简单,装备很少的东西就可以了。
1、bintray.com/注册账号,需求留意的是需求点Sign Up to an Open Source account
这个当地来注册,直接注册的话是跟网上的教程不抵挡的。

我是用Github的账号signin的,最好用github的登录注册,由于最终的代码还需求上传到github上才行。
2、创立repository,需求留意的便是姓名需求叫maven
,类型也选成Maven。bintray-release需求库房的姓名叫maven

3、依照hongyang的教程创立脚本并上传
publish {
userOrg = 'yocn'//bintray.com用户名,右上角
groupId = 'com.yocn'//jcenter上的路径
artifactId = 'seep'//项目称号
publishVersion = '1.0.0.alpha'//版本号
desc = 'Oh hi, this is a nice description for a project, right?'//描绘,不重要
website = 'https://github.com/yocn/SeepForDebug'
}
需求留意的点:
-
userOrg = 'yocn'
这个是右上角的用户名 -
website = 'https://github.com/yocn/SeepForDebug'
这个很重要,需求你把代码传到github上,这个便是你项目的地址,网上还有一些文章说不要设置成ssl的方式,这里我没有试过,不确定是不是有问题。
上传脚本就依照教程来就好了,没有什么坑
./gradlew clean build bintrayUpload -PbintrayUser=yocn -PbintrayKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -PdryRun=false
2. 遇到的几个问题
Unable to load class ‘org.gradle.api.internal.component.Usage’.
No such property: FOR_RUNTIME for class: org.gradle.api.attributes.Usage
bintray-release现在最高的版本是0.9.2,我新建的新项目用的是gradle tools 6.0.1,貌似不支持,修改成gradle-5.4.1-all.zip 对应的com.android.tools.build:gradle:3.5.2
Execution failed for task ':bintrayPublish'.
> Could not publish 'xxxx/maven/seep/1.0.0.alpha': HTTP/1.1 401 Unauthorized [message:This resource requires authentication]
要不然是用户名写错了 或者是 没有上传git,检查一下哪里的问题 3.
Could not publish 'zhaoyocn/maven/seep/1.0.0.alpha': HTTP/1.1 404 Not Found [message:Repo 'maven' was not found]
上面说的库房没有命名成maven
,添加一个叫maven
的库房重试一下。
4.
Execution failed for task ':seep:javadocRelease'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/Users/yocn/SeepForDebug/seep/build/tmp/javadocRelease/javadoc.options'
上传至jcenter时报此过错,解决方法:在项目的build.gradle的最外层加入:
tasks.getByPath(":(你想要禁止的module称号,如app):javadocRelease").enabled = false
如:
tasks.getByPath(":app:javadocRelease").enabled = false
sync项目,OK了。