@@ -19,6 +19,9 @@ apply plugin: 'maven-publish'
1919
2020version = project. ext. VERSION_NAME
2121group = POM_GROUP
22+ def keyFile = rootProject. file(" key.properties" )
23+ def keyProp = new Properties ()
24+ keyProp. load(keyFile. newInputStream())
2225
2326afterEvaluate { project ->
2427 publishing {
@@ -28,37 +31,68 @@ afterEvaluate { project ->
2831 groupId POM_GROUP
2932 artifactId POM_ARTIFACT_ID
3033 version project. ext. VERSION_NAME
34+
3135 artifact(" ${ buildDir} /outputs/aar/${ artifactId} -release.aar" )
3236 println " publish ${ buildDir} /outputs/aar/${ artifactId} -release.aar"
33- pom. withXml {
34- def dependenciesNode = asNode(). appendNode(' dependencies' )
35- // Note that this only handles implementation
36- // dependencies. In the future, may need to add api,
37- // etc.
38- configurations. implementation. allDependencies. each {
39- def dependencyNode = dependenciesNode. appendNode(' dependency' )
40- dependencyNode. appendNode(' groupId' , it. group)
41- dependencyNode. appendNode(' artifactId' , it. name)
42- dependencyNode. appendNode(' version' , it. version)
37+
38+ pom {
39+ name = POM_NAME
40+ description = POM_DESCRIPTION
41+ url = POM_URL
42+
43+ scm {
44+ url = POM_SCM_URL
45+ connection = POM_SCM_CONNECTION
46+ developerConnection = POM_SCM_DEV_CONNECTION
47+ }
48+
49+ licenses {
50+ license {
51+ name = ' The Apache License, Version 2.0'
52+ url = ' https://www.apache.org/licenses/LICENSE-2.0.txt'
53+ distribution = ' repo'
54+ }
55+ }
56+
57+ developers {
58+ developer {
59+ id = POM_DEVELOPER_ID
60+ organizationUrl = POM_DEVELOPER_ORGANIZATION_URL
61+ roles = [" developer" ]
62+ }
63+ }
64+
65+ withXml {
66+ def dependenciesNode = asNode(). appendNode(' dependencies' )
67+ // Note that this only handles implementation
68+ // dependencies. In the future, may need to add api,
69+ // etc.
70+ configurations. implementation. allDependencies. each {
71+ def dependencyNode = dependenciesNode. appendNode(' dependency' )
72+ dependencyNode. appendNode(' groupId' , it. group)
73+ dependencyNode. appendNode(' artifactId' , it. name)
74+ dependencyNode. appendNode(' version' , it. version)
75+ }
4376 }
4477 }
4578 }
4679 }
4780 repositories {
48- def keyFile = rootProject. file(" key.properties" )
49- def keyProp = new Properties ()
50- keyProp. load(keyFile. newInputStream())
51- maven { // Add Gitlab repo for aws-analytics-web-analytics
52- url keyProp. getProperty(" projectUrl" )
53- name " GitLab"
54- credentials(HttpHeaderCredentials ) {
55- name = ' Private-Token'
56- value = keyProp. getProperty(" gitLabPrivateToken" )
57- }
58- authentication {
59- header(HttpHeaderAuthentication )
81+ maven {
82+ url = " https://aws.oss.sonatype.org/service/local/staging/deploy/maven2/"
83+ credentials {
84+ username = keyProp. getProperty(" nexusUsername" )
85+ password = keyProp. getProperty(" nexusPassword" )
6086 }
6187 }
6288 }
6389 }
64- }
90+
91+ signing {
92+ def signingPassword = keyProp. getProperty(" signing.password" )
93+ def keyId = keyProp. getProperty(" signing.keyId" )
94+ def signingKey = keyProp. getProperty(" signing.inMemoryKey" ). replace(" \\ n" , " \n " )
95+ useInMemoryPgpKeys(keyId, signingKey, signingPassword)
96+ sign publishing. publications. library
97+ }
98+ }
0 commit comments