Add signing and publishing of jar
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
plugins {
@@ -5,6 +19,8 @@ plugins {
id 'checkstyle'
id 'jacoco'
id 'java'
+ id 'maven-publish'
+ id 'signing'
id 'com.adarshr.test-logger' version '2.0.0'
id 'com.diffplug.gradle.spotless' version '3.27.0'
id 'com.github.jk1.dependency-license-report' version '1.11'
@@ -22,6 +38,7 @@ ext {
jdbi3Version = '3.13.0'
lombokVersion = '1.18.12'
prometheusVersion = '0.9.0'
+ isReleaseVersion = !version.endsWith('SNAPSHOT')
}
dependencies {
@@ -77,6 +94,74 @@ task testDataAccess(type: Test) {
}
}
+task sourceJar(type: Jar) {
+ classifier 'sources'
+ from sourceSets.main.allJava
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc) {
+ classifier 'javadoc'
+ from javadoc.destinationDir
+}
+
+signing {
+ required { isReleaseVersion }
+ sign publishing.publications.mavenJava
+}
+
+publishing {
+ publications {
+ mavenJava(MavenPublication) {
+ groupId = 'io.github.marquezproject'
+ artifactId = 'marquez-java'
+
+ from components.java
+
+ artifact sourceJar
+ artifact javadocJar
+
+ pom {
+ name = 'marquez'
+ description = 'Collect, aggregate, and visualize a data ecosystem\'s metadata'
+ url = 'https://github.com/MarquezProject/marquez'
+ licenses {
+ license {
+ name = 'The Apache License, Version 2.0'
+ url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ }
+ }
+ developers {
+ developer {
+ id = 'marquezproject'
+ name = 'Marquez Project'
+ }
+ }
+ scm {
+ connection = 'scm:git:git://github.com/MarquezProject/marquez.git'
+ developerConnection = 'scm:git:ssh://github.com:MarquezProject/marquez.git'
+ url = 'https://github.com/MarquezProject/marquez'
+ }
+ }
+ }
+ }
+
+ processResources {
+ filter ReplaceTokens, tokens: [
+ "version": project.property("version")
+ ]
+ }
+
+ repositories {
+ maven {
+ url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
+ credentials {
+ username = System.getenv('SONATYPE_NEXUS_USERNAME')
+ password = System.getenv('SONATYPE_NEXUS_PASSWORD')
+ }
+ }
+ }
+}
+
mainClassName = 'marquez.MarquezApp'
shadowJar {
