|
1 | 1 | // This build file is based on/inspired by https://autsoft.net/publishing-an-android-library-to-mavencentral-in-2019/
|
2 | 2 |
|
3 | 3 | apply plugin: 'java'
|
4 |
| -apply plugin: 'distribution' |
5 | 4 | apply plugin: 'maven-publish'
|
6 |
| -apply plugin: 'signing' |
7 |
| - |
8 | 5 |
|
9 | 6 | task javadocJar(type: Jar, dependsOn: javadoc) {
|
10 | 7 | from javadoc.destinationDir
|
@@ -33,48 +30,11 @@ artifacts {
|
33 | 30 | tasks.withType(GenerateModuleMetadata) {
|
34 | 31 | enabled = false // fix for https://github.com/remkop/picocli/issues/1152
|
35 | 32 | }
|
36 |
| -distributions { |
37 |
| - main { |
38 |
| - distributionBaseName = "${project.name}-all" |
39 |
| - contents { |
40 |
| - from jar |
41 |
| - from javadocJar |
42 |
| - from sourcesJar |
43 |
| - from testJar |
44 |
| - from testSourcesJar |
45 |
| - from ('LICENSE') |
46 |
| - from ("$rootDir/RELEASE-NOTES.md") |
47 |
| - } |
48 |
| - } |
49 |
| -} |
50 | 33 |
|
51 | 34 | // different for each module
|
52 | 35 | group = PUBLISH_GROUP_ID
|
53 | 36 | version = PUBLISH_VERSION
|
54 | 37 |
|
55 |
| -ext["signing.keyId"] = '' |
56 |
| -ext["signing.password"] = '' |
57 |
| -ext["signing.secretKeyRingFile"] = '' |
58 |
| -ext["ossrhUsername"] = '' |
59 |
| -ext["ossrhPassword"] = '' |
60 |
| -ext["sonatypeStagingProfileId"] = '' |
61 |
| - |
62 |
| -File secretPropsFile = project.rootProject.file('local.properties') |
63 |
| -if (secretPropsFile.exists()) { |
64 |
| - Properties p = new Properties() |
65 |
| - p.load(new FileInputStream(secretPropsFile)) |
66 |
| - p.each { name, value -> |
67 |
| - ext[name] = value |
68 |
| - } |
69 |
| -} else { |
70 |
| - ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') |
71 |
| - ext["signing.password"] = System.getenv('SIGNING_PASSWORD') |
72 |
| - ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') |
73 |
| - ext["ossrhUsername"] = System.getenv('MAVEN_OSS_USER') |
74 |
| - ext["ossrhPassword"] = System.getenv('MAVEN_OSS_PASSWORD') |
75 |
| - ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') |
76 |
| -} |
77 |
| - |
78 | 38 | publishing {
|
79 | 39 | publications {
|
80 | 40 | release(MavenPublication) {
|
@@ -118,27 +78,8 @@ publishing {
|
118 | 78 | }
|
119 | 79 | repositories {
|
120 | 80 | maven {
|
121 |
| - name = "sonatype" |
122 |
| - url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" |
123 |
| - |
124 |
| - credentials { |
125 |
| - username = ossrhUsername |
126 |
| - password = ossrhPassword |
127 |
| - } |
| 81 | + url = rootProject.layout.buildDirectory.dir('staging-deploy') |
128 | 82 | }
|
129 | 83 | }
|
130 | 84 | }
|
131 | 85 |
|
132 |
| -ext.isReleaseVersion = !version.endsWith("SNAPSHOT") |
133 |
| - |
134 |
| -signing { |
135 |
| - required = { isReleaseVersion && gradle.taskGraph.hasTask("publish") } |
136 |
| - sign publishing.publications |
137 |
| -} |
138 |
| - |
139 |
| -nexusStaging { |
140 |
| - packageGroup = PUBLISH_GROUP_ID |
141 |
| - stagingProfileId = '5db36034f05d47' // Log in to https://oss.sonatype.org/, go to Staging profiles, select your profile, and look at the ID in the URL |
142 |
| - username = ossrhUsername |
143 |
| - password = ossrhPassword |
144 |
| -} |
0 commit comments