From 7efe478d12dd1135ae07c9871e8b2e5c6d0c2f45 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Sun, 13 Dec 2020 02:02:53 -0700 Subject: [PATCH 1/5] setup for publishing package, current published version with this config is 1.0.1 --- build.gradle | 78 +++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 0d1b48e..0bfb8ab 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,16 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * This generated file contains a sample Java Library project to get you started. - * For more details take a look at the Java Libraries chapter in the Gradle - * User Manual available at https://docs.gradle.org/6.5.1/userguide/java_library_plugin.html - */ - plugins { - // Apply the java-library plugin to add support for Java Library id 'java-library' id 'info.solidsoft.pitest' version '1.5.1' + id 'maven-publish' + id 'signing' +} + +group = 'com.github.shnewto' +version = '1.0.1' + +java { + withJavadocJar() + withSourcesJar() } repositories { @@ -19,12 +20,9 @@ repositories { } dependencies { - // This dependency is exported to consumers, that is to say found on their compile classpath. - api 'org.apache.commons:commons-math3:3.6.1' - implementation 'com.google.cloud:google-cloud-bigquery:1.126.1' implementation 'com.google.code.gson:gson:2.8.6' - implementation 'org.slf4j:slf4j-log4j12:1.7.30' + implementation 'org.slf4j:slf4j-api:1.7.2' testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1' testImplementation 'org.junit.platform:junit-platform-runner:1.7.0' @@ -44,3 +42,57 @@ pitest { } build.dependsOn 'pitest' + +publishing { + publications { + mavenJava(MavenPublication) { + artifactId = 'bqjson' + from components.java + pom { + name = 'bqjson' + description = 'Serialize/Deserialize BigQuery TableResults (and TableResult adjacent types) to/from JSON.' + url = 'https://github.com/shnewto/bqjson' + licenses { + license { + name = 'MIT License' + url = 'https://github.com/shnewto/bqjson/blob/main/LICENSE' + } + } + developers { + developer { + id = 'shnewto' + name = 'Shea Newton' + email = 'shnewto@gmail.com' + } + } + scm { + connection = 'scm:git:git://github.com/shnewto/bqjson.git' + developerConnection = 'scm:git:ssh://github.com/shnewto/bqjson.git' + url = 'http://github.com/shnewto/bqjson/' + } + } + } + } + repositories { + maven { + // change URLs to point to your repos, e.g. http://my.org/repo + 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 project.property('ossrhUsername') + password project.property('ossrhPassword') + } + } + } +} + +signing { + sign publishing.publications.mavenJava +} + +javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} \ No newline at end of file From 7227b49656bee412ad49ac90c92cd7bf589b4bb2 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Sun, 13 Dec 2020 02:11:05 -0700 Subject: [PATCH 2/5] nexus badge --- README.md | 4 ++-- build.gradle | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 421ec82..4444016 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -![](https://github.com/shnewto/bqjson/workflows/CI/badge.svg?branch=main) - +![GitHub Actions CI](https://github.com/shnewto/bqjson/workflows/CI/badge.svg?branch=main) +![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.github.shnewto/bqjson?server=https%3A%2F%2Foss.sonatype.org%2F) # bqjson Serialize/Deserialize BigQuery TableResults (and TableResult adjacent types) to/from JSON. diff --git a/build.gradle b/build.gradle index 0bfb8ab..8611321 100644 --- a/build.gradle +++ b/build.gradle @@ -95,4 +95,4 @@ javadoc { if(JavaVersion.current().isJava9Compatible()) { options.addBooleanOption('html5', true) } -} \ No newline at end of file +} From f346041ade4ce4313094ceb66b0f390806309f98 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Sun, 13 Dec 2020 02:13:22 -0700 Subject: [PATCH 3/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4444016..ddb63df 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ ![GitHub Actions CI](https://github.com/shnewto/bqjson/workflows/CI/badge.svg?branch=main) -![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.github.shnewto/bqjson?server=https%3A%2F%2Foss.sonatype.org%2F) +[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/com.github.shnewto/bqjson?server=https%3A%2F%2Foss.sonatype.org%2F)](https://search.maven.org/artifact/com.github.shnewto/bqjson) # bqjson Serialize/Deserialize BigQuery TableResults (and TableResult adjacent types) to/from JSON. From db9b91fc5941486b72f0e6019b24e4291cb2480b Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Sun, 13 Dec 2020 02:21:22 -0700 Subject: [PATCH 4/5] add some empty creds for CI --- gradle/wrapper/gradle-wrapper.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bb8b2fc..2163f8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,3 +3,5 @@ distributionPath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +ossrhUsername= +ossrhPassword= \ No newline at end of file From 45f5092367574ef2f614b573943731b730a7da64 Mon Sep 17 00:00:00 2001 From: Shea Newton Date: Sun, 13 Dec 2020 02:29:46 -0700 Subject: [PATCH 5/5] handle if cred properties are missing --- build.gradle | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 8611321..ca9b1be 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,9 @@ pitest { build.dependsOn 'pitest' +def ossrhUsername=project.properties['ossrhUsername'] ?: "" +def ossrhPassword=project.properties['ossrhPassword'] ?: "" + publishing { publications { mavenJava(MavenPublication) { @@ -80,8 +83,8 @@ publishing { def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/" url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl credentials { - username project.property('ossrhUsername') - password project.property('ossrhPassword') + username ossrhUsername + password ossrhPassword } } }