Skip to content

Commit

Permalink
setup maven central manual publish
Browse files Browse the repository at this point in the history
  • Loading branch information
gordonmu committed Apr 24, 2021
1 parent 386ed5c commit 4ffd5b9
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 48 deletions.
19 changes: 5 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ buildscript {
ext.repos = {
mavenLocal()
mavenCentral()
jcenter()
maven {
url 'https://plugins.gradle.org/m2/'
}
Expand All @@ -36,18 +35,13 @@ buildscript {
classpath group: 'org.jetbrains.kotlin', name: 'kotlin-gradle-plugin', version: "$kotlin_version"
classpath group: 'com.google.protobuf', name: 'protobuf-gradle-plugin', version: "$protobufgradle_version"
classpath group: 'org.ysb33r.gradle', name: 'doxygen', version: "$doxygen_version"
classpath group: 'com.jfrog.bintray.gradle', name: 'gradle-bintray-plugin', version: '1.+'
}

if (project.hasProperty("executeAllTests") && project.findProperty("executeAllTests").toBoolean()) {
gradle.startParameter.continueOnFailure = true
}
}

if (!project.hasProperty('bintrayUser'))
ext.bintrayUser = ''
if (!project.hasProperty('bintrayApikey'))
ext.bintrayApikey = ''
ext.pomConfig = {
licenses {
license {
Expand All @@ -68,7 +62,7 @@ allprojects {
apply plugin: 'kotlin'
apply plugin: 'maven-publish'

group 'com.github.gordonmu.coio'
group 'io.github.gordonmu'
version = '0.8.0'
if (!project.hasProperty("release")) {
version += '-SNAPSHOT'
Expand Down Expand Up @@ -103,20 +97,17 @@ allprojects {
useJUnitPlatform()
}

javadoc.options.addStringOption('Xdoclint:none', '-quiet')
javadoc.failOnError = false
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
archiveClassifier.set('javadoc')
archiveClassifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
archiveClassifier.set('sources')
}

artifacts {
archives sourcesJar
archives javadocJar
archives sourcesJar, javadocJar
}
}
68 changes: 51 additions & 17 deletions gordonmu-coio-tls/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'
apply plugin: 'signing'

dependencies {
implementation project(":gordonmu-coio")
Expand Down Expand Up @@ -46,21 +46,55 @@ publishing {
}
}

bintray {
user = bintrayUser
key = bintrayApikey
publications = ['maven']
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')) {
signing {
sign configurations.archives
}
}

if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pkg {
repo = 'jvm'
name = project.name
description = 'A CoIO extension to use TLS over any CoIOStream.'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/gordonmu/coio.git'
version {
name = project.version
desc = project.version
released = new Date()
pom.project {
name project.name
packaging 'jar'
// optionally artifactId can be defined here
description 'A CoIO extension to use TLS over any CoIOStream.'
url 'https://github.com/gordonmu/coio'

scm {
connection 'scm:git:https://github.com/gordonmu/coio.git'
developerConnection 'scm:git:https://github.com/gordonmu/coio.git'
url 'https://github.com/gordonmu/coio'
}

licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id 'gordonmu'
name 'Gordon Mu'
email '[email protected]'
}
}
}
}
}
}
}
}
68 changes: 51 additions & 17 deletions gordonmu-coio/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven'
apply plugin: 'signing'

dependencies {
implementation group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: "$kotlin_version"
Expand Down Expand Up @@ -41,21 +41,55 @@ publishing {
}
}

bintray {
user = bintrayUser
key = bintrayApikey
publications = ['maven']

pkg {
repo = 'jvm'
name = project.name
description = 'A library for a simple coroutine IO API, wrapping efficient non-blocking Java IO libs for easy use.'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/gordonmu/coio.git'
version {
name = project.version
desc = project.version
released = new Date()
if (project.hasProperty('signing.keyId') && project.hasProperty('signing.password') && project.hasProperty('signing.secretKeyRingFile')) {
signing {
sign configurations.archives
}
}

if (project.hasProperty('ossrhUsername') && project.hasProperty('ossrhPassword')) {
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name project.name
packaging 'jar'
// optionally artifactId can be defined here
description 'A library for a simple coroutine IO API, wrapping efficient non-blocking Java IO libs for easy use.'
url 'https://github.com/gordonmu/coio'

scm {
connection 'scm:git:https://github.com/gordonmu/coio.git'
developerConnection 'scm:git:https://github.com/gordonmu/coio.git'
url 'https://github.com/gordonmu/coio'
}

licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}

developers {
developer {
id 'gordonmu'
name 'Gordon Mu'
email '[email protected]'
}
}
}
}
}
}
}

0 comments on commit 4ffd5b9

Please sign in to comment.