apply plugin: 'maven' apply plugin: 'signing' def PUBLISH_GROUP_ID = "io.github.yyxxgame.sdk" def PUBLISH_ARTIFACT_ID = "eyuangame-sdk-ktx" def PUBLISH_VERSION = "1.0.0-alpha7" Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) def ossrhUsername = properties.getProperty("SonaType.user") def ossrhPassword = properties.getProperty("SonaType.pwd") task androidSourcesJar(type: Jar) { archiveClassifier.set('source') if (project.plugins.findPlugin('com.android.library')) { from android.sourceSets.main.java.srcDirs } else { form sourceSets.main.java.srcDirs } } artifacts { archives androidSourcesJar } signing { required { gradle.taskGraph.hasTask("uploadArchives") } sign configurations.archives } uploadArchives { repositories { mavenDeployer { beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { authentication(userName: ossrhUsername, password: ossrhPassword) } snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") { authentication(userName: ossrhUsername, password: ossrhPassword) } pom.groupId = PUBLISH_GROUP_ID pom.artifactId = PUBLISH_ARTIFACT_ID pom.version = PUBLISH_VERSION pom.project { name "${PUBLISH_GROUP_ID}:${PUBLISH_ARTIFACT_ID}" packaging 'aar' description 'game sdk of EYuan' url 'https://github.com/yyxxgame' scm { connection 'scm:git:ogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git' developerConnection 'scm:git:ssh://gogs.yyxxgame.com:3000/Client/EYuanGameSdk-KTX.git' url 'http://gogs.yyxxgame.com/Client/EYuanGameSdk-KTX' } licenses { license { name 'The Apache License, Version 2.0' url 'http://www.apache.org/licenses/LICENSE-2.0.txt' } } developers { developer { id 'yyxxgame' name 'yyxxgame' email 'developcentre@yyxxgame.com' } } } } } }