@@ -4,17 +4,13 @@ plugins {
44 id " io.freefair.lombok" version " 8.13.1"
55 // to make our tests output more fancy
66 id ' com.adarshr.test-logger' version ' 4.0.0'
7- // to publish packages
8- id ' maven-publish'
97 // code linting
108 id " com.diffplug.spotless" version " 7.0.3"
119 // test coverage
1210 id ' jacoco'
1311 id ' com.github.kt3k.coveralls' version ' 2.12.2'
14- // signing
15- id " signing"
16- // nexus publishing
17- id " io.github.gradle-nexus.publish-plugin" version " 2.0.0"
12+ // Maven central publishing
13+ id " com.vanniktech.maven.publish" version " 0.34.0"
1814}
1915
2016compileJava {
@@ -28,7 +24,8 @@ spotless {
2824 }
2925}
3026
31- task createProperties (dependsOn : processResources) {
27+ tasks. register(' createProperties' ) {
28+ dependsOn processResources
3229 doLast {
3330 file(" ${ layout.buildDirectory.get()} /resources/main/truelayer-java.version.properties" ). withWriter { w ->
3431 Properties p = new Properties ()
@@ -147,66 +144,43 @@ jacocoTestReport {
147144 }
148145}
149146
150- task sourcesJar ( type : Jar ) {
147+ tasks . register( ' sourcesJar ' , Jar ) {
151148 from sourceSets. main. allJava
152149 archiveClassifier = ' sources'
153150}
154151
155- task javadocJar ( type : Jar ) {
152+ tasks . register( ' javadocJar ' , Jar ) {
156153 from javadoc
157154 archiveClassifier = ' javadoc'
158155}
159156
160- publishing {
161- publications {
162- mavenJava(MavenPublication ) {
163- from(components. java)
164- artifact sourcesJar
165- artifact javadocJar
166-
167- pom {
168- name = project_name
169- packaging = ' jar'
170- description = project_description
171- url = project_url
172- scm {
173- connection = project_scm
174- developerConnection = project_scm
175- url = project_url
176- }
177- licenses {
178- license {
179- name = project_license_name
180- url = project_license_url
181- }
182- }
183- developers {
184- developer {
185- id = project_developer
186- name = project_developer
187- }
188- }
189- }
190- }
191- }
192- }
157+ mavenPublishing {
158+ publishToMavenCentral()
193159
194- ext. isReleaseVersion = ! version. endsWith(" SNAPSHOT" )
195- signing {
196- def signingKey = System . getenv(' SONATYPE_GPG_KEY' )
197- def signingPassword = System . getenv(' SONATYPE_GPG_PASSPHRASE' )
198- useInMemoryPgpKeys(signingKey, signingPassword)
199- sign publishing. publications. mavenJava
200- required { isReleaseVersion && gradle. taskGraph. hasTask(" publish" ) }
201- }
160+ // signAllPublications()
202161
203- nexusPublishing {
204- repositories {
205- sonatype {
206- nexusUrl = uri(sonatype_repository_url)
207- snapshotRepositoryUrl = uri(sonatype_snapshot_repository_url)
208- username = System . getenv(" SONATYPE_USERNAME" )
209- password = System . getenv(" SONATYPE_PASSWORD" )
162+ pom {
163+ name = project_name
164+ packaging = ' jar'
165+ description = project_description
166+ url = project_url
167+ scm {
168+ connection = project_scm
169+ url = project_url
170+ }
171+ licenses {
172+ license {
173+ name = project_license_name
174+ url = project_license_url
175+ distribution = project_license_url
176+ }
177+ }
178+ developers {
179+ developer {
180+ id = developer_name
181+ name = developer_name
182+ url = developer_url
183+ }
210184 }
211185 }
212186}
0 commit comments