Commit a60b9a7b by zhengnw@sobot.com

publishToMavenCentralPortal

parent da87b757
// Top-level build file where you can add configuration options common to all sub-projects/modules. import org.gradle.api.tasks.Delete
buildscript { buildscript {
repositories { repositories {
gradlePluginPortal()
mavenCentral() mavenCentral()
google() google()
maven { url "https://jitpack.io" }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.4.2' classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' classpath 'tech.yanand.maven-central-publish:tech.yanand.maven-central-publish.gradle.plugin:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
} }
allprojects { allprojects {
repositories { repositories {
gradlePluginPortal()
mavenCentral() mavenCentral()
google() google()
maven { url "https://jitpack.io" }
} }
} }
task clean(type: Delete) { tasks.register('clean', Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit # This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
...@@ -17,3 +14,11 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 ...@@ -17,3 +14,11 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Android operating system, and which are packaged with your app"s APK # Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn # https://developer.android.com/topic/libraries/support-library/androidx-rn
android.injected.testOnly=false android.injected.testOnly=false
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
signing.secretKeyRingFile=D\:\\sobotproject\\sdkproject\\Sobot_module_Dev\\secring.gpg
signing.password=Sobot@123456
signing.keyId=B9D8A005
authTokenValue=K2cxMUpJbCs6NTZrUEJMOUl5ejVabThOcGR6WUlQU2hVWjEvR2Y5cFd3NmtQaDV4ZFVOTFY=
\ No newline at end of file
#Tue Nov 19 15:03:00 CST 2019 #Tue Apr 08 16:22:01 CST 2025
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
\ No newline at end of file
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -16,23 +17,6 @@ ext { ...@@ -16,23 +17,6 @@ ext {
} }
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
publishing { publishing {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
...@@ -74,57 +58,6 @@ publishing { ...@@ -74,57 +58,6 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "sobotwidget"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
...@@ -132,3 +65,14 @@ publishing { ...@@ -132,3 +65,14 @@ publishing {
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -15,24 +16,6 @@ ext { ...@@ -15,24 +16,6 @@ ext {
PUBLISH_VERSION = '2.3.0' //版本号 PUBLISH_VERSION = '2.3.0' //版本号
} }
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
publishing { publishing {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
...@@ -74,57 +57,6 @@ publishing { ...@@ -74,57 +57,6 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "sobotcommon"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
...@@ -132,3 +64,14 @@ publishing { ...@@ -132,3 +64,14 @@ publishing {
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -15,26 +16,6 @@ ext { ...@@ -15,26 +16,6 @@ ext {
PUBLISH_VERSION = '1.2.0' //版本号 1.2 已经被使用了,需要跳过它 PUBLISH_VERSION = '1.2.0' //版本号 1.2 已经被使用了,需要跳过它
} }
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
publishing { publishing {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
...@@ -76,61 +57,22 @@ publishing { ...@@ -76,61 +57,22 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "gson"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
} }
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -76,57 +77,6 @@ publishing { ...@@ -76,57 +77,6 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "net"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
...@@ -134,3 +84,14 @@ publishing { ...@@ -134,3 +84,14 @@ publishing {
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -15,26 +16,6 @@ ext { ...@@ -15,26 +16,6 @@ ext {
PUBLISH_VERSION = '1.2.6' //版本号 PUBLISH_VERSION = '1.2.6' //版本号
} }
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
publishing { publishing {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
...@@ -76,57 +57,6 @@ publishing { ...@@ -76,57 +57,6 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "picture"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
...@@ -134,3 +64,14 @@ publishing { ...@@ -134,3 +64,14 @@ publishing {
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -12,29 +13,9 @@ task androidSourcesJar(type: Jar) { ...@@ -12,29 +13,9 @@ task androidSourcesJar(type: Jar) {
ext { ext {
PUBLISH_GROUP_ID = "com.sobot.library" //项目包名 PUBLISH_GROUP_ID = "com.sobot.library" //项目包名
PUBLISH_ARTIFACT_ID = 'utils' //项目名 PUBLISH_ARTIFACT_ID = 'utils' //项目名
PUBLISH_VERSION = '1.1.3' //版本号 PUBLISH_VERSION = '1.1.3.1' //版本号
} }
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
publishing { publishing {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
...@@ -76,57 +57,6 @@ publishing { ...@@ -76,57 +57,6 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "utils"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
...@@ -134,3 +64,14 @@ publishing { ...@@ -134,3 +64,14 @@ publishing {
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing' apply plugin: 'signing'
apply plugin: 'tech.yanand.maven-central-publish'
task androidSourcesJar(type: Jar) { tasks.register('androidSourcesJar', Jar) {
classifier = 'sources' archiveClassifier = 'sources'
from android.sourceSets.main.java.source from android.sourceSets.main.java.source
exclude "**/R.class" exclude "**/R.class"
...@@ -16,24 +17,6 @@ ext { ...@@ -16,24 +17,6 @@ ext {
PUBLISH_VERSION = '2.0.0' // 特别注意项目名:版本号 PUBLISH_VERSION = '2.0.0' // 特别注意项目名:版本号
} }
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.secretKeyRingFile"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
println "Found secret props file, loading props"
Properties p = new Properties()
p.load(new FileInputStream(secretPropsFile))
p.each { name, value ->
ext[name] = value
}
} else {
println "No props file, loading env vars"
}
publishing { publishing {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
...@@ -75,57 +58,6 @@ publishing { ...@@ -75,57 +58,6 @@ publishing {
//分支地址: //分支地址:
url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master' url = 'http://code.zhichidata.com/sobot_android/Sobot_module_Dev/master'
} }
// A slightly hacky fix so that your POM will include any transitive dependencies
// that your library builds upon
// withXml {
// def dependenciesNode = asNode().appendNode('dependencies')
//
// project.configurations.implementation.allDependencies.each {
// def dependencyNode = dependenciesNode.appendNode('dependency')
// dependencyNode.appendNode('groupId', it.group)
// dependencyNode.appendNode('artifactId', it.name)
// dependencyNode.appendNode('version', it.version)
// }
// }
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//跳过“unspecified”的依赖项
//避免出现问题:
//Execution failed for task ':sample:checkDebugAarMetadata'.
//> Could not resolve all files for configuration ':sample:debugRuntimeClasspath'.
// > Could not find :unspecified:.
// Required by:
project.configurations.implementation.allDependencies.each {
if (it.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
}
repositories {
// The repository to publish to, Sonatype/MavenCentral
maven {
// This is an arbitrary name, you may also use "mavencentral" or
// any other name that's descriptive for you
//项目名称
name = "sobotwidget"
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
// You only need this if you want to publish snapshots, otherwise just set the URL
// to the release repo directly
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
// The username and password we've fetched earlier
credentials {
username ossrhUsername
password ossrhPassword
} }
} }
} }
...@@ -133,3 +65,14 @@ publishing { ...@@ -133,3 +65,14 @@ publishing {
signing { signing {
sign publishing.publications sign publishing.publications
} }
mavenCentral {
authToken = rootProject.ext.has("authTokenValue") ? rootProject.ext.authTokenValue : ""
// 上传是否应该自动发布。如果您希望手动执行此操作,请使用 'USER_MANAGED'。
// 该属性是可选的,默认为 'AUTOMATIC'。
publishingType = "USER_MANAGED"
// 当发布类型为 'AUTOMATIC' 时,状态API获取 'PUBLISHING' 或 'PUBLISHED' 状态的最大等待时间
// 或者当发布类型为 'USER_MANAGED' 时,获取 'VALIDATED' 状态。
// 该属性是可选的,默认为60秒。
maxWait = 60
}
\ No newline at end of file
1、点击Gradle 窗口:sobot_utils() -> Tasks -> build -> assemble
1、点击Gradle 窗口:sobot_utils() -> Tasks -> build -> assemble
生成aar
2、发布
点击Gradle 窗口:sobot_utils()-> Tasks build -> central publish -> publishToMavenCentralPortal
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment