Skip to content

Commit

Permalink
ISSUE-757: Sign and publish artifacts (#760)
Browse files Browse the repository at this point in the history
Updated the gradle build files so it's ready for publishing into Sonatype repo
  • Loading branch information
gcsaba2 authored Oct 3, 2022
1 parent a617ffc commit f7d1995
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 54 deletions.
102 changes: 56 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

allprojects {
repositories {

Expand All @@ -36,10 +35,10 @@ subprojects {
group = 'com.hortonworks.registries'

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'project-report'
apply plugin: 'jacoco'
apply plugin: 'com.bmuschko.nexus'
apply plugin: 'checkstyle'
apply plugin: 'signing'

Expand Down Expand Up @@ -155,67 +154,79 @@ subprojects {
}

// jersey-shaded has custom publication and we don't publish any test artifacts
if (it.name != 'jersey-shaded' & it.name != 'behavior-tests') {
if (it.name != 'jersey-shaded' && it.name != 'behavior-tests' && it.name != 'hortonworks-registries-bin' && it.name != 'hortonworks-registries-docker') {
publishing {
publications {
mavenJava(MavenPublication) {
groupId = group
from components.java

pom {
name = 'Schema Registry'
url = 'https://github.com/hortonworks/registry'

scm {
url = 'https://github.com/hortonworks/registry'
connection = 'scm:git:[email protected]:hortonworks/registry.git'
developerConnection = 'scm:git:[email protected]:hortonworks/registry.git'
}

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

developers {
developer {
id = 'galyo'
name = 'Csaba Galyo'
email = '[email protected]'
}
developer {
id = 'csenge.maruzsi'
name = 'Csenge Virag Maruzsi'
email = '[email protected]'
}
developer {
id = 'acsaki'
name = 'Andras Csaki'
email = '[email protected]'
}
}
}

}
}
}

signing {
//useGpgCmd() // enable if using command line gpg
sign publishing.publications.mavenJava
}
}

// put your password into ~/.gradle/build.gradle and then run "gradle sign uploadArchive" to upload into nexus
modifyPom {
project {
name 'Registry'
description 'Registry is a versioned entity framework that allows to build various registry services such as Schema Registry, ML Model Registry etc..'
url 'http://github.com/hortonworks/registry'

artifacts {
archives javadocJar, sourcesJar
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

scm {
url 'http://github.com/hortonworks/registry'
connection 'scm:git:git://github.com/hortonworks/registry.git'
developerConnection 'scm:git:[email protected]:hortonworks/registry.git'
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: nexusUsername, password: nexusPassword)
}

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: nexusUsername, password: nexusPassword)
}

developers {
developer {
id 'galyo'
name 'Csaba Galyo'
email '[email protected]'
}
developer {
id 'csenge.maruzsi'
name 'Csenge Virag Maruzsi'
email '[email protected]'
}
}
}
}
}

extraArchive {
sources = false
tests = false
javadoc = false
}

nexus {
sign = true
repositoryUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
snapshotRepositoryUrl = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}

Expand All @@ -228,7 +239,6 @@ buildscript {
}

dependencies {
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
classpath "com.github.ben-manes:gradle-versions-plugin:0.36.0"
classpath "com.peterabeles.gversion:com.peterabeles.gversion.gradle.plugin:1.10"
classpath "com.github.jengelman.gradle.plugins:shadow:5.2.0"
Expand Down
11 changes: 11 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ versions_validation_api = 1.1.0.Final
# all other modules derive their dependencies from dropwizard-bom
versions_jackson2=2.10.5
versions_jersey2=2.35

# PUBLISHING CONFIGURATION
# uncomment if you need to sign and upload the artifacts
#signing.gnupg.executable=gpg
#signing.gnupg.useLegacyGpg=true
#signing.gnupg.optionsFile=/home/galyo/.gnupg/gpg.conf
#signing.gnupg.keyName=xxx
#signing.gnupg.passphrase=xxx
#
#nexusUsername=xxx
#nexusPassword=xxx
11 changes: 3 additions & 8 deletions registry-dist/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,10 @@ dependencies {

}

/*
signing {
//useGpgCmd() // enable if using command line gpg
sign distTar
sign distZip
}

//uploadArchives {
// repositories {
// mavenDeployer {
// repository(url: "https://oss.sonatype.org/content/repositories/snapshots")
// }
// }
//}
*/

0 comments on commit f7d1995

Please sign in to comment.