diff --git a/build.gradle b/build.gradle index 60400bd..92c4823 100644 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,15 @@ -buildscript { - repositories { - mavenCentral() - // Needed only for SNAPSHOT versions - maven { url "http://oss.sonatype.org/content/repositories/snapshots/" } - } - dependencies { - classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0" - } -} - -version = '0.6.2-SNAPSHOT' +version = '0.6.4-SNAPSHOT' apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'osgi' -apply plugin: 'maven' +apply plugin: 'maven-publish' apply plugin: 'signing' -apply plugin: 'io.codearte.nexus-staging' buildscript { repositories { jcenter() } - - dependencies { - classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.7.1' - } } repositories { @@ -89,61 +73,65 @@ artifacts { archives sourcesJar } -signing { - sign configurations.archives -} - -signArchives.onlyIf { - project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile') -} - def doUploadArchives = project.hasProperty('sonatypeUsername') && project.hasProperty('sonatypePassword') +publish.onlyIf { doUploadArchives } if(doUploadArchives) { - uploadArchives { - repositories.mavenDeployer { - beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } - - repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - - snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots') { - authentication(userName: sonatypeUsername, password: sonatypePassword) - } - - pom.project { - name 'Flowless' - description 'Efficient VirtualFlow for JavaFX.' - url 'http://www.fxmisc.org/flowless/' - packaging 'jar' - licenses { - license { - name 'The BSD 2-Clause License' - url 'http://opensource.org/licenses/BSD-2-Clause' - distribution 'repo' - } - } - scm { - url 'scm:git@github.com:FXMisc/Flowless.git' - connection 'scm:git@github.com:FXMisc/Flowless.git' - developerConnection 'scm:git@github.com:FXMisc/Flowless.git' + publishing { + repositories { + maven { + def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots" + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl + credentials { + username = "${sonatypeUsername}" + password = "${sonatypePassword}" } - developers { - developer { - name 'Tomas Mikula' + } + } + publications { + flowless(MavenPublication) { + from components.java + artifact sourcesJar + artifact javadocJar + pom { + name = 'flowless' + packaging = 'jar' + description = 'Efficient VirtualFlow for JavaFX.' + url = 'https://github.com/FXMisc/Flowless/#flowless' + + scm { + url = 'scm:git@github.com:FXMisc/flowless.git' + connection = 'scm:git@github.com:FXMisc/Flowless.git' + developerConnection = 'scm:git@github.com:FXMisc/Flowless.git' } - developer { - name 'Jordan Martinez' + + licenses { + license { + name = 'The BSD 2-Clause License' + url = 'http://opensource.org/licenses/BSD-2-Clause' + distribution = 'repo' + } } + + developers { + developer { + name = 'Tomas Mikula' + } + developer { + name = 'Jordan Martinez' + } + } } } } } + + signing { + sign publishing.publications.flowless + } } -uploadArchives.onlyIf { doUploadArchives } - assemble.dependsOn fatJar task getVersion { @@ -151,7 +139,3 @@ task getVersion { println version } } - -nexusStaging { - packageGroup = "org.fxmisc.flowless" -}