加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
publish.gradle 4.21 KB
一键复制 编辑 原始数据 按行查看 历史
山野羡民 提交于 2016-10-22 18:41 . travis jobs failed?
apply plugin: 'maven-publish' //发布项目到maven库
apply plugin: 'com.jfrog.bintray' //上传项目到jcenter
version = project.pomVersion //版本号
group = GROUP // 包名
project.archivesBaseName = project.pomArtifactId
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.srcDirs
classpath += configurations.compile
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
exclude '**/BuildConfig.java'
exclude '**/R.java'
failOnError = false
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
javadoc {
options {
encoding "UTF-8"
charSet 'UTF-8'
author true
version true
links "http://docs.oracle.com/javase/7/docs/api"
title project.pomArtifactId
}
}
publishing {
publications {
myPublicationName(MavenPublication) {
artifactId project.pomArtifactId
artifact "${buildDir}/outputs/aar/${project.pomArtifactId}-release.aar"
artifact javadocJar
artifact sourcesJar
pom.withXml {
Node root = asNode()
root.appendNode('name', project.pomArtifactId)
root.appendNode('description', project.pomDescription)
root.appendNode('url', SITE_URL)
def issues = root.appendNode('issueManagement')
issues.appendNode('system', 'github')
issues.appendNode('url', SITE_URL)
def scm = root.appendNode('scm')
scm.appendNode('url', GIT_URL)
scm.appendNode('connection', "scm:git:${GIT_URL}")
scm.appendNode('developerConnection', "scm:git:${GIT_URL}")
def license = root.appendNode('licenses').appendNode('license')
license.appendNode('name', "The Apache Software License, Version 2.0")
license.appendNode('url', "http://www.apache.org/licenses/LICENSE-2.0.txt")
license.appendNode('distribution', "repo")
def developer = root.appendNode('developers').appendNode('developer')
developer.appendNode('id', DEVELOPER_ID)
developer.appendNode('name', DEVELOPER_NAME)
developer.appendNode('email', DEVELOPER_EMAIL)
def dependenciesNode = root.appendNode('dependencies')
configurations.compile.allDependencies.each {
if (it.group && it.name && it.version) {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
bintray {
// You should configure "bintray.user" and "bintray.apiKey" in the gradle.properties
// that in gradle cache directory (~/.gradle/gradle.properties)
try {
user = getProperty("bintray.user")
key = getProperty("bintray.apikey")
} catch (Exception e) {
System.err.println("bintray exception: " + e);
user = ""
key = ""
}
publications = ['myPublicationName'] //对应前面的publishing.publications.mavenJava
publish = true //是否发布
pkg {
repo = "maven" //上传的中央仓库名称
name = project.pomArtifactId //发布到中央仓库上的项目名字
desc = project.pomDescription
websiteUrl = SITE_URL //项目主页
issueTrackerUrl = ISSUE_URL //项目讨论页
vcsUrl = GIT_URL //项目GIT仓库
licenses = ["Apache-2.0"]
publicDownloadNumbers = true
version {
name = project.pomVersion
desc = project.pomDescription
gpg {
sign = false //是否GPG签名,可使用Gpg4win创建密钥文件
}
mavenCentralSync {
sync = false //是否同步到Maven Central
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化