Skip to content

Commit

Permalink
publishing artifact to the central maven repository
Browse files Browse the repository at this point in the history
  • Loading branch information
alexradzin committed Oct 4, 2023
1 parent d0695e0 commit 149cdd7
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
79 changes: 63 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -22,6 +24,7 @@ project.ext {

java {
withSourcesJar()
withJavadocJar()
}

compileJava {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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('/', '.')
}
}
Expand Down Expand Up @@ -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 = "[email protected]"
}
developer {
id = "ptiurin"
name = "Petro Tiurin"
email = "[email protected]"
}
developer {
id = "kevin"
name = "Kevin Marr"
email = "[email protected]"
}
developer {
id = "aymeric"
name = "Aymeric Dispa"
email = "[email protected]"
}
developer {
id = "alexradzin"
name = "Alexander Radzin"
email = "[email protected]"
}
developer {
id = "reelsen"
name = "Alexander Reelsen"
email = "[email protected]"
}
}
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")
}
}
}
Expand All @@ -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')) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version=2.4.6-SNAPSHOT
version=2.4.6
jdbcVersion=4.3
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/firebolt/jdbc/util/VersionUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void shouldGetDriverMinorVersion() {

@Test
void shouldGetProjectVersion() {
assertEquals("2.4.6-SNAPSHOT", VersionUtil.getDriverVersion());
assertEquals("2.4.6", VersionUtil.getDriverVersion());
}

@Test
Expand Down

0 comments on commit 149cdd7

Please sign in to comment.