代码拉取完成,页面将自动刷新
// 依赖信息
def groupIdDefined = "com.licheedev"
def artifactIdDefined = "android-serialport"
// 如果是测试版,版本号后面加上 -SNAPSHOT
def versionDefined = rootProject.ext.versionName
// 其他信息
def gitUrl = "https://github.com/licheedev/Android-SerialPort-API"
// 配置是否上传
def toUpload = true
//在根build.gradle中加入,最新版本号参考 https://github.com/Kotlin/dokka#using-dokka
//classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32'
//在module的build.gradle末位加入
//apply from: '../maven_publish.gradle'
if (toUpload) {
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'org.jetbrains.dokka'
//<editor-fold desc="打包源码和javadoc">
// 打包源码
task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
}
task javadoc(type: Javadoc) {
failOnError false
source = android.sourceSets.main.java.sourceFiles
options {
encoding = "utf-8"
charSet 'UTF-8'
}
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
classpath += configurations.compile
}
// 打包javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// 打包包含kotlin源码的javadoc
task kotlinDocJar(type: Jar, dependsOn: dokkaHtml) {
classifier = 'javadoc'
from dokkaHtml.outputDirectory
}
//</editor-fold>
afterEvaluate {
publishing {
publications {
mavenAndroid(MavenPublication) {
from components.release
groupId "$groupIdDefined"
artifactId "$artifactIdDefined"
version "$versionDefined"
// 上传source
artifact sourcesJar
// 上传javadoc
if (project.plugins.hasPlugin('kotlin-android')) {
artifact kotlinDocJar
} else {
artifact javadocJar
}
pom {
name = 'Android-SerialPort-API'
description = 'Android-SerialPort-API'
url = "$gitUrl"
//licenses {
// license {
// name = 'The MIT License'
// url = 'https://opensource.org/licenses/MIT'
// }
//}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'licheedev'
name = 'John Lee'
email = 'licheedev@foxmail.com'
}
}
scm {
connection = "$gitUrl"
developerConnection = "${gitUrl}.git"
url = "$gitUrl"
}
}
}
}
repositories {
maven {
// 依赖发布地址
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// 配置账号密码
println "user=${ossrhUsername},key=${ossrhPassword}"
credentials {
username "${ossrhUsername}"
password "${ossrhPassword}"
}
}
}
}
signing {
sign publishing.publications.mavenAndroid
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。