From 5b63ac91e93b2ae1d4a74875f41e3b8fa6c07825 Mon Sep 17 00:00:00 2001 From: John Burns Date: Tue, 28 Oct 2025 16:27:06 -0500 Subject: [PATCH] add test to verify that root project contacts are used in subproject POMs --- build.gradle | 8 +++ gradle.lockfile | 4 ++ .../maven/MavenDeveloperPluginTest.groovy | 53 +++++++++++++++++++ 3 files changed, 65 insertions(+) create mode 100644 src/test/groovy/nebula/plugin/publishing/maven/MavenDeveloperPluginTest.groovy diff --git a/build.gradle b/build.gradle index f789734..48b583f 100644 --- a/build.gradle +++ b/build.gradle @@ -262,3 +262,11 @@ gradlePlugin { tasks.withType(Test).configureEach { maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 } + +testing { + suites { + test { + useJUnitJupiter() + } + } +} \ No newline at end of file diff --git a/gradle.lockfile b/gradle.lockfile index 87e7e62..defd57e 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -60,6 +60,10 @@ org.jfrog.buildinfo:build-info-extractor-gradle:6.0.2=integTestCompileClasspath, org.jfrog.buildinfo:build-info-extractor:2.41.22=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.jfrog.filespecs:file-specs-java:1.1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.jspecify:jspecify:1.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-api:5.12.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.12.2=integTestRuntimeClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-params:5.12.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter:5.12.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit.platform:junit-platform-commons:1.14.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit.platform:junit-platform-engine:1.14.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit.platform:junit-platform-launcher:1.14.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath diff --git a/src/test/groovy/nebula/plugin/publishing/maven/MavenDeveloperPluginTest.groovy b/src/test/groovy/nebula/plugin/publishing/maven/MavenDeveloperPluginTest.groovy new file mode 100644 index 0000000..b6a3678 --- /dev/null +++ b/src/test/groovy/nebula/plugin/publishing/maven/MavenDeveloperPluginTest.groovy @@ -0,0 +1,53 @@ +package nebula.plugin.publishing.maven + +import groovy.xml.XmlSlurper +import nebula.test.dsl.GroovyTestProjectBuilder +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.io.TempDir + +import static nebula.test.dsl.TestKitAssertions.assertThat + +class MavenDeveloperPluginTest { + @TempDir + File projectDir + + @Test + void test_multiproject() { + def runner = GroovyTestProjectBuilder.testProject(projectDir) { + rootProject { + plugins { + id("com.netflix.nebula.contacts") + } + rawBuildScript(""" +contacts { + 'nebula@example.test' { + moniker 'Example Nebula' + github 'nebula-plugins' + } +} +""") + } + subProject("sub1") { + plugins { + id("java") + id("com.netflix.nebula.contacts") + id 'com.netflix.nebula.maven-developer' + id 'com.netflix.nebula.maven-nebula-publish' + } + } + } + + def result = runner.run(':sub1:generatePomFileForNebulaPublication') + assertThat(result).hasNoDeprecationWarnings() + def pomFile = new File(projectDir, 'sub1/build/publications/nebula/pom-default.xml') + assertThat(pomFile).exists() + + def pom = new XmlSlurper().parse(pomFile) + + def devs = pom.developers.developer + assertThat(devs.size()).isEqualTo(1) + assertThat(devs[0].name.text()).isEqualTo('Example Nebula') + assertThat(devs[0].email.text()).isEqualTo('nebula@example.test') + assertThat(devs[0].id.text()).isEqualTo('nebula-plugins') + } +}