diff --git a/README.md b/README.md index be3e8c6..1bb0d8a 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,12 @@ for current features, their requirement descriptions and migration from junit4. See [LICENSE.txt](LICENSE.txt) to make your company's lawyer happy. See [CHANGES.txt](CHANGES.txt) for API changes and updates. + +## Snapshot artifacts and releases + +We do not publish snapshot artifacts. If you'd like to work with a snapshot, +use gradle's composite build or install maven artifacts locally with: + +``` +./gradlew publishToMavenLocal +``` diff --git a/build.gradle b/build.gradle index b3a48cc..9374db8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,26 @@ plugins { alias(libs.plugins.spotless) apply false + alias(libs.plugins.nexus.publish) } +apply from: file('gradle/scripts/publishing-sonatype-central.gradle') + allprojects { group = 'com.carrotsearch.randomizedtesting' version = '0.1.0-SNAPSHOT' } +nexusPublishing { + repositories { + sonatype { + nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/") + snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/") + username = findProperty("nexusUsername") ?: "" + password = findProperty("nexusPassword") ?: "" + } + } +} + subprojects { apply plugin: 'java-library' apply plugin: 'com.diffplug.spotless' diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2d22362..e53acde 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ assertj = "3.27.7" googleJavaFormat = "1.34.1" junit = "6.0.3" +nexus-publish = "2.0.0" spotless = "8.3.0" [libraries] @@ -12,4 +13,5 @@ junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher junit-platform-testkit = { module = "org.junit.platform:junit-platform-testkit", version.ref = "junit" } [plugins] +nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } diff --git a/gradle/scripts/publishing-sonatype-central.gradle b/gradle/scripts/publishing-sonatype-central.gradle new file mode 100644 index 0000000..c209547 --- /dev/null +++ b/gradle/scripts/publishing-sonatype-central.gradle @@ -0,0 +1,69 @@ +def published = [ + ":randomizedtesting-jupiter" +] + +configure(subprojects.findAll { it.path in published }) { + apply plugin: 'maven-publish' + apply plugin: 'signing' + + // Hack: do not generate or publish gradle metadata files. + tasks.withType(GenerateModuleMetadata).configureEach { + enabled = false + } + + plugins.withType(JavaPlugin).configureEach { + java { + withSourcesJar() + withJavadocJar() + } + + publishing { + def configurePom = { + name = "${project.name}" + description = "${project.name}" + url = 'https://github.com/randomizedtesting/randomizedtesting-jupiter' + inceptionYear = "2026" + + licenses { + license { + name = 'ASL 2.0 License' + url = 'https://github.com/randomizedtesting/randomizedtesting-jupiter/blob/main/LICENSE.txt' + } + } + + organization { + name = "Carrot Search s.c." + url = "https://www.carrotsearch.com" + } + + developers { + developer { + id = 'dawid.weiss' + name = 'Dawid Weiss' + email = 'dawid.weiss@carrotsearch.com' + } + } + scm { + connection = 'scm:git:git@github.com:randomizedtesting/randomizedtesting-jupiter.git' + developerConnection = 'scm:git:git@github.com:randomizedtesting/randomizedtesting-jupiter.git' + url = 'https://github.com/randomizedtesting/randomizedtesting-jupiter' + } + } + + publications { + jars(MavenPublication) { + from components.java + groupId = project.group + artifactId = project.base.archivesName.get() + + pom(configurePom) + } + } + } + + signing { + required = { !project.version.endsWith('-SNAPSHOT') } + sign publishing.publications.jars + } + } +}