From 149cdd7ce389dcc75b2ef3636dd2f6701025f611 Mon Sep 17 00:00:00 2001 From: alexradzin Date: Sun, 10 Sep 2023 11:43:00 +0300 Subject: [PATCH] publishing artifact to the central maven repository --- .github/workflows/release.yml | 4 +- build.gradle | 79 +++++++++++++++---- gradle.properties | 2 +- .../FireboltDatabaseMetadataTest.java | 2 +- .../firebolt/jdbc/util/VersionUtilTest.java | 2 +- 5 files changed, 68 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adc1abf30..0b9adf583 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,5 +34,5 @@ jobs: - name: Deploy to Repsy repository run: ./gradlew publish env: - REPSY_USERNAME: ${{ secrets.REPSY_USERNAME }} - REPSY_PASSWORD: ${{ secrets.REPSY_PASSWORD }} + REPSY_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }} + REPSY_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }} diff --git a/build.gradle b/build.gradle index 020963f66..4cce9a35c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,8 @@ plugins { id "org.sonarqube" version "4.3.1.3277" id 'maven-publish' id 'com.github.johnrengelman.shadow' version '8.0.0' + id 'org.quiltmc.gradle.licenser' version '2.0.1' + id 'signing' } group 'io.firebolt' @@ -22,6 +24,7 @@ project.ext { java { withSourcesJar() + withJavadocJar() } compileJava { @@ -91,6 +94,8 @@ dependencies { compileTestJava.dependsOn processTestResources jar.dependsOn processTestResources jar.dependsOn processIntegrationTestResources + javadoc.dependsOn processTestResources + javadoc.dependsOn processIntegrationTestResources compileTestCommonJava.dependsOn processTestResources compileTestCommonJava.dependsOn processIntegrationTestResources compileIntegrationTestJava.dependsOn processIntegrationTestResources @@ -151,7 +156,7 @@ shadowJar { JarFile jf = new JarFile(jar) jf.entries().each { entry -> if (entry.name.endsWith(".class") && entry.name != "module-info.class" && - !entry.name.startsWith('org/slf4j') && !entry.name.startsWith('ch/qos/logback')) { + !entry.name.startsWith('org/slf4j') && !entry.name.startsWith('ch/qos/logback')) { packages << entry.name[0..entry.name.lastIndexOf('/')-1].replaceAll('/', '.') } } @@ -194,22 +199,71 @@ publishing { publications { maven(MavenPublication) { from components.java + pom { + name = "firebolt-jdbc" + description = 'Type 4 JDBC driver that allows connection to Firebolt Database' + url = "https://github.com/firebolt-db/jdbc" + licenses { + license { + name = "The Apache License, Version 2.0" + url = "http://www.apache.org/licenses/LICENSE-2.0.txt" + } + } + developers { + developer { + id = "JonyBoyko" + name = "Ivan Boyko" + email = "107884978+yingli017@users.noreply.github.com" + } + developer { + id = "ptiurin" + name = "Petro Tiurin" + email = "petro.tiurin@firebolt.io" + } + developer { + id = "kevin" + name = "Kevin Marr" + email = "kevin@firebolt.io" + } + developer { + id = "aymeric" + name = "Aymeric Dispa" + email = "aymeric@firebolt.io" + } + developer { + id = "alexradzin" + name = "Alexander Radzin" + email = "alexander.radzin@firebolt.io" + } + developer { + id = "reelsen" + name = "Alexander Reelsen" + email = "alexander@reelsen.net" + } + } + scm { + connection = "scm:svn:https://github.com/firebolt-db/jdbc/" + developerConnection = "scm:svn:https://github.com/firebolt-db/jdbc/" + url = "https://github.com/firebolt-db/jdbc/" + } + } // remove dependencies due to shaded jar pom.withXml { - node = asNode() - node.remove(node.get('dependencies')) + node = asNode() + node.remove(node.get('dependencies')) } } } repositories { maven { - def releasesRepoUrl = 'https://repo.repsy.io/mvn/firebolt/maven' - def snapshotsRepoUrl = 'https://repo.repsy.io/mvn/firebolt/maven-snapshots' + def releasesRepoUrl = 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/' + def snapshotsRepoUrl = 'https://s01.oss.sonatype.org/content/repositories/snapshots/' + url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl credentials { - username System.getenv("REPSY_USERNAME") - password System.getenv("REPSY_PASSWORD") + username System.getenv("MAVEN_REPO_USERNAME") + password System.getenv("MAVEN_REPO_PASSWORD") } } } @@ -233,15 +287,8 @@ jar { } } -task generateJavadoc(type: Javadoc) { - failOnError false - source = sourceSets.main.allJava - classpath = sourceSets.main.runtimeClasspath - classpath = classpath + sourceSets.main.compileClasspath - options { - links = ['https://docs.oracle.com/javase/8/docs/api/'] - } - options.addStringOption('Xdoclint:none', '-quiet') +signing { + sign publishing.publications } if (hasProperty('buildScan')) { diff --git a/gradle.properties b/gradle.properties index 0faed3411..d9c342e28 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=2.4.6-SNAPSHOT +version=2.4.6 jdbcVersion=4.3 \ No newline at end of file diff --git a/src/test/java/com/firebolt/jdbc/metadata/FireboltDatabaseMetadataTest.java b/src/test/java/com/firebolt/jdbc/metadata/FireboltDatabaseMetadataTest.java index eb8ca7d14..d798c6b25 100644 --- a/src/test/java/com/firebolt/jdbc/metadata/FireboltDatabaseMetadataTest.java +++ b/src/test/java/com/firebolt/jdbc/metadata/FireboltDatabaseMetadataTest.java @@ -310,7 +310,7 @@ void shouldGetDriverMinorVersion() { @Test void shouldGetDriverVersion() throws SQLException { - assertEquals("2.4.6-SNAPSHOT", fireboltDatabaseMetadata.getDriverVersion()); + assertEquals("2.4.6", fireboltDatabaseMetadata.getDriverVersion()); } @Test diff --git a/src/test/java/com/firebolt/jdbc/util/VersionUtilTest.java b/src/test/java/com/firebolt/jdbc/util/VersionUtilTest.java index 0e4331c6c..a6f435a68 100644 --- a/src/test/java/com/firebolt/jdbc/util/VersionUtilTest.java +++ b/src/test/java/com/firebolt/jdbc/util/VersionUtilTest.java @@ -18,7 +18,7 @@ void shouldGetDriverMinorVersion() { @Test void shouldGetProjectVersion() { - assertEquals("2.4.6-SNAPSHOT", VersionUtil.getDriverVersion()); + assertEquals("2.4.6", VersionUtil.getDriverVersion()); } @Test