1 Star 0 Fork 203

java10000/easy-okhttp

forked from miles/easy-okhttp 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
binary.gradle 3.83 KB
一键复制 编辑 原始数据 按行查看 历史
//上传到jcenter至少需要四个文件,除了打包的jar之外,
//还需要pom和javadoc,source,否则是通不过jcenter审核的。
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'java'
group GROUP
version VERSION_NAME
//如何解决编译、生成JavaDOC和测试时注释的乱码问题
[compileJava, javadoc, compileTestJava]*.options*.encoding = 'UTF-8'
def getBintrayUserProperty() {
return hasProperty('BINTRAY_USER') ? BINTRAY_USER : ""
}
def getBintrayApiKeyProperty() {
return hasProperty('BINTRAY_APIKEY') ? BINTRAY_APIKEY : ""
}
//根据jcenter的审核要求 必须包含sourceJar和docJar
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
//上传
publishing {
publications {
mavenJava(MavenPublication) {
//GAV配置
groupId GROUP
artifactId ARTIFACT_ID
version VERSION_NAME
from components.java
artifact sourceJar
artifact javadocJar
//pom相关信息
pom.withXml {
Node root = asNode()
root.appendNode('name', ARTIFACT_ID)
root.appendNode('description', POM_DESCRIPTION)
root.appendNode('url', POM_URL)
def issues = root.appendNode('issueManagement')
issues.appendNode('system', 'github')
issues.appendNode('url', ISSUE_URL)
def scm = root.appendNode('scm')
scm.appendNode('url', POM_SCM_URL)
scm.appendNode('connection', POM_SCM_CONNECTION)
scm.appendNode('developerConnection', POM_SCM_DEV_CONNECTION)
def license = root.appendNode('licenses').appendNode('license')
license.appendNode('name', POM_LICENCE_NAME)
license.appendNode('url', POM_LICENCE_URL)
license.appendNode('distribution', POM_LICENCE_DIST)
def developer = root.appendNode('developers').appendNode('developer')
developer.appendNode('id', POM_DEVELOPER_ID)
developer.appendNode('name', POM_DEVELOPER_NAME)
developer.appendNode('email', POM_DEVELOPER_EMAIL)
developer.appendNode('url', POM_DEVELOPER_URL)
developer.appendNode('timezone', '+8')
developer.appendNode('roles').appendNode('role', POM_DEVELOPER_ROLE)
}
}
}
}
// gradle bintrayUpload
bintray {
user = getBintrayUserProperty()
key = getBintrayApiKeyProperty()
publications = ['mavenJava']
// configurations = ['archives']
dryRun = false
publish = true
pkg {
//你在bintray建立的仓库类型
repo = 'maven'
//包名
name = ARTIFACT_ID
//描述
desc = POM_DESCRIPTION
//站点地址
websiteUrl = POM_URL
//缺陷提交地址
issueTrackerUrl = ISSUE_URL
//版本库地址
vcsUrl = GIT_URL
//许可证
licenses = ['Apache-2.0']
labels = ['java', 'network', 'HttpClient', 'okhttp']
publicDownloadNumbers = true
version {
//版本号
name = VERSION_NAME
//版本描述
desc = POM_DESCRIPTION
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = BINTRAY_GPG_PWD//Optional. The passphrase for GPG signing'
}
// //添加部分
// mavenCentralSync {
// sync = true
// user = BINTRAY_OSS_USER
// password = BINTRAY_OSS_PASSWORD
// close = '1'
// }
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/java10000/easy-okhttp.git
[email protected]:java10000/easy-okhttp.git
java10000
easy-okhttp
easy-okhttp
master

搜索帮助