1+ apply plugin : ' maven-publish'
12apply plugin : ' signing'
2- apply plugin : " de.marcphilipp.nexus-publish"
3- apply plugin : " io.codearte.nexus-staging"
4- apply plugin : ' digital.wup.android-maven-publish'
53
6- if (hasProperty(" ossrhTokenPassword" )) {
7- signing {
8- sign configurations. archives
4+ // === Configure Android publishing (sources/javadoc jars) ===
5+ android {
6+ publishing {
7+ singleVariant(' release' ) {
8+ withSourcesJar()
9+ withJavadocJar()
10+ }
911 }
12+ }
1013
11- nexusStaging {
12- packageGroup = group
13- username = project. hasProperty(" ossrhToken" ) ? project. ext[" ossrhToken" ] : " "
14- password = project. hasProperty(" ossrhTokenPassword" ) ? project. ext[" ossrhTokenPassword" ] : " "
15- }
14+ def getReleaseComponent () {
15+ return components. findByName(" release" )
16+ }
1617
18+ // === Publishing Configuration ===
19+ afterEvaluate {
1720 publishing {
1821 publications {
19- mavenAar(MavenPublication ) {
20- from components. android
22+ release(MavenPublication ) {
23+ from getReleaseComponent()
24+
25+ groupId = publishGroupId
26+ artifactId = publishArtifactId
27+ version = publishVersion
2128
2229 pom {
2330 name = publishArtifactName
24- packaging = ' aar'
25- groupId = publishGroupId
26- artifactId = publishArtifactId
2731 description = publishDescription
2832 url = githubUrl
2933 licenses {
@@ -32,7 +36,6 @@ if (hasProperty("ossrhTokenPassword")) {
3236 url = licenseUrl
3337 }
3438 }
35-
3639 developers {
3740 developer {
3841 id = developerId
@@ -49,37 +52,19 @@ if (hasProperty("ossrhTokenPassword")) {
4952 }
5053 }
5154
52- nexusPublishing {
53- repositories {
54- sonatype {
55- username = project. hasProperty(" ossrhToken" ) ? project. ext[" ossrhToken" ] : " "
56- password = project. hasProperty(" ossrhTokenPassword" ) ? project. ext[" ossrhTokenPassword" ] : " "
55+ repositories {
56+ maven {
57+ name = " Sonatype"
58+ url = uri(" https://s01.oss.sonatype.org/content/repositories/releases/" )
59+ credentials {
60+ username = System . getenv(" OSSRH_USERNAME" )
61+ password = System . getenv(" OSSRH_PASSWORD" )
5762 }
5863 }
5964 }
6065 }
6166
62- // Configure signing to happen after evaluation
63- afterEvaluate {
64- signing. sign publishing. publications. mavenAar
65- }
66- }
67-
68- // Enable sources and javadoc generation for Android libraries
69- android {
70- publishing {
71- singleVariant(' release' ) {
72- withSourcesJar()
73- withJavadocJar()
74- }
67+ signing {
68+ sign publishing. publications. release
7569 }
7670}
77-
78- // Ensure signing happens before publishing
79- tasks. withType(PublishToMavenRepository ) {
80- dependsOn tasks. withType(Sign )
81- }
82-
83- tasks. withType(GenerateModuleMetadata ) {
84- enabled = false
85- }
0 commit comments