@@ -17,13 +17,6 @@ apply plugin: 'maven'
1717apply plugin : ' signing'
1818apply plugin : ' maven-publish'
1919
20- version = VERSION_NAME
21- group = GROUP
22-
23- def isReleaseBuild () {
24- return VERSION_NAME . contains(" SNAPSHOT" ) == false
25- }
26-
2720def getReleaseRepositoryUrl () {
2821 return hasProperty(' RELEASE_REPOSITORY_URL' ) ? RELEASE_REPOSITORY_URL :
2922 " https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/"
@@ -42,18 +35,16 @@ def getRepositoryPassword() {
4235 return hasProperty(' SONATYPE_NEXUS_PASSWORD' ) ? SONATYPE_NEXUS_PASSWORD : " "
4336}
4437
45- archivesBaseName = POM_ARTIFACT_ID
46-
4738afterEvaluate { project ->
4839 uploadArchives {
4940 repositories {
5041 if (project. hasProperty(' SONATYPE_NEXUS_USERNAME' )) {
5142 mavenDeployer {
5243 beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
5344
54- pom. groupId = GROUP
45+ pom. groupId = POM_GROUP
5546 pom. artifactId = POM_ARTIFACT_ID
56- pom. version = VERSION_NAME
47+ pom. version = project . ext . VERSION_NAME
5748
5849 repository(url : getReleaseRepositoryUrl()) {
5950 authentication(userName : getRepositoryUsername(), password : getRepositoryPassword())
@@ -95,16 +86,19 @@ afterEvaluate { project ->
9586 }
9687 } else {
9788 mavenInstaller {
98- pom. groupId = GROUP
89+ pom. groupId = POM_GROUP
9990 pom. artifactId = POM_ARTIFACT_ID
100- pom. version = VERSION_NAME
91+ pom. version = project . ext . VERSION_NAME
10192 }
10293 }
10394 }
10495 }
10596
10697 signing {
107- required { isReleaseBuild() && gradle. taskGraph. hasTask(" uploadArchives" ) }
98+ required {
99+ project. ext. VERSION_NAME . contains(" SNAPSHOT" ) == false &&
100+ gradle. taskGraph. hasTask(" uploadArchives" )
101+ }
108102 sign configurations. archives
109103 }
110104
@@ -114,9 +108,9 @@ afterEvaluate { project ->
114108 repositories. mavenInstaller {
115109 configuration = configurations. archives
116110
117- pom. groupId = GROUP
111+ pom. groupId = POM_GROUP
118112 pom. artifactId = POM_ARTIFACT_ID
119- pom. version = VERSION_NAME
113+ pom. version = project . ext . VERSION_NAME
120114
121115 pom. project {
122116 name POM_NAME
@@ -166,9 +160,9 @@ afterEvaluate { project ->
166160 } else {
167161 install {
168162 repositories. mavenInstaller {
169- pom. groupId = GROUP
163+ pom. groupId = POM_GROUP
170164 pom. artifactId = POM_ARTIFACT_ID
171- pom. version = VERSION_NAME
165+ pom. version = project . ext . VERSION_NAME
172166
173167 pom. project {
174168 name POM_NAME
@@ -219,9 +213,9 @@ afterEvaluate { project ->
219213 publishing {
220214 publications {
221215 library(MavenPublication ) {
222- groupId GROUP
216+ groupId POM_GROUP
223217 artifactId POM_ARTIFACT_ID
224- version VERSION_NAME
218+ version project . ext . VERSION_NAME
225219 artifact(" ${ buildDir} /outputs/aar/${ artifactId} -release.aar" )
226220 pom. withXml {
227221 def dependenciesNode = asNode(). appendNode(' dependencies' )
0 commit comments