Skip to content

Commit 4f71f2e

Browse files
authored
Upgraded Gradle Maven plugin (#910)
1 parent 1ce4fac commit 4f71f2e

1 file changed

Lines changed: 57 additions & 57 deletions

File tree

richtextfx/build.gradle

Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ buildscript {
66

77
plugins {
88
id 'org.unbroken-dome.test-sets' version '2.1.1'
9+
id 'osgi'
10+
id 'maven-publish'
11+
id 'signing'
912
}
1013

11-
apply plugin: 'osgi'
12-
apply plugin: 'maven'
13-
apply plugin: 'signing'
14-
1514
group = 'org.fxmisc.richtext'
1615

1716
testSets {
@@ -187,66 +186,67 @@ artifacts {
187186
archives sourcesJar
188187
}
189188

190-
signing {
191-
sign configurations.archives
192-
}
193-
194-
signArchives.onlyIf {
195-
project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')
196-
}
197-
198189
def doUploadArchives = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword')
190+
publish.onlyIf { doUploadArchives }
199191

200192
if(doUploadArchives) {
201-
uploadArchives {
202-
repositories.mavenDeployer {
203-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
204-
205-
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
206-
authentication(userName: sonatypeUsername, password: sonatypePassword)
193+
publishing {
194+
repositories {
195+
maven {
196+
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
197+
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
198+
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
199+
credentials {
200+
username = "${sonatypeUsername}"
201+
password = "${sonatypePassword}"
202+
}
203+
}
204+
}
205+
publications {
206+
richTextFX(MavenPublication) {
207+
from components.java
208+
artifact sourcesJar
209+
artifact javadocJar
210+
pom {
211+
name = 'RichTextFX'
212+
packaging = 'jar'
213+
description = 'Rich-text area for JavaFX'
214+
url = 'https://github.com/FXMisc/RichTextFX/#richtextfx'
215+
216+
scm {
217+
url = 'scm:git@github.com:FXMisc/RichTextFX.git'
218+
connection = 'scm:git@github.com:FXMisc/RichTextFX.git'
219+
developerConnection = 'scm:git@github.com:FXMisc/RichTextFX.git'
220+
}
221+
222+
licenses {
223+
license {
224+
name = 'The BSD 2-Clause License'
225+
url = 'http://opensource.org/licenses/BSD-2-Clause'
226+
distribution = 'repo'
227+
}
228+
license {
229+
name = 'GPLv2 with the Classpath Exception'
230+
url = 'http://www.gnu.org/software/classpath/license.html'
231+
distribution = 'repo'
232+
}
233+
}
234+
235+
developers {
236+
developer {
237+
name = 'Tomas Mikula'
238+
}
239+
}
240+
}
207241
}
208-
209-
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') {
210-
authentication(userName: sonatypeUsername, password: sonatypePassword)
211-
}
212-
213-
pom.project {
214-
name 'RichTextFX'
215-
packaging 'jar'
216-
description 'Rich-text area for JavaFX'
217-
url 'https://github.com/FXMisc/RichTextFX/#richtextfx'
218-
219-
scm {
220-
url 'scm:git@github.com:FXMisc/RichTextFX.git'
221-
connection 'scm:git@github.com:FXMisc/RichTextFX.git'
222-
developerConnection 'scm:git@github.com:FXMisc/RichTextFX.git'
223-
}
224-
225-
licenses {
226-
license {
227-
name 'The BSD 2-Clause License'
228-
url 'http://opensource.org/licenses/BSD-2-Clause'
229-
distribution 'repo'
230-
}
231-
license {
232-
name 'GPLv2 with the Classpath Exception'
233-
url 'http://www.gnu.org/software/classpath/license.html'
234-
distribution 'repo'
235-
}
236-
}
237-
238-
developers {
239-
developer {
240-
name 'Tomas Mikula'
241-
}
242-
}
243-
}
244-
}
242+
}
243+
}
244+
245+
signing {
246+
sign publishing.publications.richTextFX
245247
}
246248
}
247249

248-
uploadArchives.onlyIf { doUploadArchives }
249-
250250
task fatJar(type: Jar, dependsOn: classes) {
251251
appendix = 'fat'
252252
manifest.attributes( 'Automatic-Module-Name': 'org.fxmisc.richtext', 'Multi-Release': 'true' )

0 commit comments

Comments
 (0)