Skip to content

feat: [FFM-12481]: Migrate to Maven Central Portal #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 80 additions & 83 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import com.vanniktech.maven.publish.SonatypeHost
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar

buildscript {
repositories {
Expand All @@ -10,7 +13,6 @@ buildscript {
plugins {
id 'java'
id 'jvm-test-suite'
id 'maven-publish'
id "signing"
id "org.openapi.generator" version libs.versions.openapi.generator
id "com.diffplug.spotless" version libs.versions.spotless
Expand All @@ -19,6 +21,7 @@ plugins {
id "com.github.spotbugs" version libs.versions.spotbugs
id "org.owasp.dependencycheck" version libs.versions.depcheck
id 'me.champeau.jmh' version '0.6.8' // Added JMH plugin
id "com.vanniktech.maven.publish" version "0.33.0"
}


Expand All @@ -34,8 +37,6 @@ allprojects {

java {
sourceCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}

apply plugin: 'java-library'
Expand Down Expand Up @@ -152,94 +153,83 @@ testing {
}
}

publishing {
repositories {
maven {
credentials {
username System.getenv("MAVEN_USERNAME") != null ? System.getenv("MAVEN_USERNAME") : ""
password System.getenv("MAVEN_PASSWORD") != null ? System.getenv("MAVEN_PASSWORD") : ""
}
mavenPublishing {

def sonatypeSnapshotRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
def sonatypeStagingRepo="https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
url = version.endsWith('SNAPSHOT') ? sonatypeSnapshotRepo : sonatypeStagingRepo
}
}
// To publish, make sure the following env vars are set
//
// ORG_GRADLE_PROJECT_mavenCentralUsername
// ORG_GRADLE_PROJECT_mavenCentralPassword

publications.create("mavenJava", MavenPublication) {
from components.java
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
signAllPublications()

pom {
description = project.description
name = project.name
url = "https://github.com/harness/ff-java-server-sdk"
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))

licenses {
license {
name = "Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
pom {
description = project.description
name = project.name
url = "https://github.com/harness/ff-java-server-sdk"

scm {
developerConnection = "scm:git:ssh://https://github.com/harness/ff-java-server-sdk.git"
connection = "scm:git:ssh://https://github.com/harness/ff-java-server-sdk.git"
url = "https://github.com/drone/ff-java-server-sdk"
licenses {
license {
name = "Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}

developers {
developer {
id = "andybharness"
name = "Andrew Bell"
email = "andrew.bell@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "davejohnston"
name = "Dave Johnston"
email = "dave.johnston@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "enver-bisevac"
name = "Enver Bisevac"
email = "enver.bisevac@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "rushabh-harness"
name = "Rushabh Shah"
email = "rushabh@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "hannah-tang"
name = "Hannah Tang"
email = "hannah.tang@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "subiradhikari"
name = "Subir Adhikari"
email = "subir.adhikari@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
}
scm {
developerConnection = "scm:git:ssh://https://github.com/harness/ff-java-server-sdk.git"
connection = "scm:git:ssh://https://github.com/harness/ff-java-server-sdk.git"
url = "https://github.com/drone/ff-java-server-sdk"
}
}
}

signing {
required { gradle.taskGraph.hasTask("publish") }
developers {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these do anything? Should we change them to the current team and remove the legacy folks like dodgy @davejohnston

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gone, but not forgotten.

developer {
id = "andybharness"
name = "Andrew Bell"
email = "andrew.bell@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "davejohnston"
name = "Dave Johnston"
email = "dave.johnston@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "enver-bisevac"
name = "Enver Bisevac"
email = "enver.bisevac@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "rushabh-harness"
name = "Rushabh Shah"
email = "rushabh@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "hannah-tang"
name = "Hannah Tang"
email = "hannah.tang@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
developer {
id = "subiradhikari"
name = "Subir Adhikari"
email = "subir.adhikari@harness.io"
organization = "Harness Inc"
organizationUrl = "https://www.harness.io/"
}
}

sign publishing.publications.mavenJava
}
}

spotless {
Expand All @@ -261,8 +251,6 @@ dependencyCheck {
compileJava.dependsOn tasks.openApiGenerate
compileJava.dependsOn generateVersion
compileJava.dependsOn spotlessApply
sourcesJar.dependsOn tasks.openApiGenerate
sourcesJar.dependsOn generateVersion
jacocoTestReport.dependsOn test
spotbugsTest.enabled = false
spotbugsMain.enabled = false
Expand All @@ -272,3 +260,12 @@ sourceSets.main.java.srcDirs += [ "$buildDir/generated/src/main/java", "$buildDi
tasks.withType(Javadoc).configureEach {
options.addStringOption('Xdoclint:none', '-quiet')
}

tasks.named("sourcesJar") {
dependsOn(tasks.named("generateVersion"))
}

wrapper {
gradleVersion = '8.14.2'
distributionType = Wrapper.DistributionType.ALL
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ dependencyResolutionManagement {
versionCatalogs {
libs {
// main sdk version
version('sdk', '1.8.0');
version('sdk', '1.8.1');

// sdk deps
version('okhttp3', '4.12.0')
Expand Down
Loading