java-gen: POM identity fields are coupled to a hardcoded "publisher is Pulumi" gate, so non-Pulumi providers cannot get a valid POM
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 85
- Forks
- 26
- Avg merge
- 11h 49m
- Merged PRs (30d)
- 22
Description
Summary
pulumi-java-gen emits a build.gradle whose POM <name>, <inceptionYear>, and <developers> block are populated only when the package metadata satisfies isPublishedByPulumi(pkg). The same gated branch also rewrites groupId to com.pulumi. As a result, a provider that wants a non-com.pulumi groupId (e.g. com.pulumi.labs, or a third-party publisher) cannot get those POM fields filled in at all, even when its schema carries a DisplayName, Publisher, and License that could populate them.
Maven Central rejects publications with an empty <name> (and complains about missing developer information), so any non-Pulumi groupId requires post-codegen string surgery on the generated build.gradle to ship.
Where this lives
pkg/codegen/java/templates_gradle.go — newGradleTemplateContext:
if isPublishedByPulumi(pkg) {
ctx.GroupID = "com.pulumi"
ctx.DeveloperID = "pulumi"
ctx.DeveloperName = "Pulumi"
ctx.DeveloperEmail = "support@pulumi.com"
ctx.ProjectInceptionYear = "2022"
ctx.ProjectName = fmt.Sprintf("pulumi-%s", ctx.Name)
}
isPublishedByPulumi keys off pkg.Publisher == "pulumi" (case-insensitive) or pkg.Homepage host being pulumi.com/pulumi.io.
pkg/codegen/java/package_info.go (the LanguageMap.java payload) exposes only BasePackage, BuildFiles, Repositories, Dependencies, GradleNexusPublishPluginVersion, GradleTest — none of which can override the POM identity fields above.
Net effect: anyone publishing under a non-com.pulumi groupId is forced to pick one of:
- Set
Publisher: "Pulumi"/Homepage: https://pulumi.com/...to trigger the branch, then accept thatgroupIdis silently rewritten tocom.pulumi(defeating the original intent). - Leave
Publisheras something else and live with an empty<name>, no inception year, no developer block — which Maven Central rejects. - Post-process the generated file in their own build pipeline.
Proposed fix
Decouple POM identity from the publisher gate:
- Always populate
ProjectName(default toctx.NameorBasePackage + "-" + ctx.Name, or honor a newPackageInfo.ProjectName/ schemaDisplayNameif set). - Always populate
ProjectInceptionYearfrom a sensible default (current year, or a new optionalPackageInfo.InceptionYear). - Honor
pkg.Publisheras the developer name andpkg.Repository/pkg.Homepagefor SCM, regardless of whether the publisher string equals"pulumi". Optionally addPackageInfo.DeveloperEmailfor the developer email (since email is rarely embedded inschema.Packagedirectly). - Keep the
isPublishedByPulumibranch only for thecom.pulumigroupIddefault, but skip it wheneverPackageInfo.BasePackageis explicitly set (so a publisher that asked forcom.pulumi.labskeeps it).
This makes the path symmetric: any schema with enough metadata produces a Maven-Central-publishable POM, and the hardcoded com.pulumi defaults stay only as a convenience fallback for Pulumi's own providers.
Repro
Generate a Java SDK from a schema where Publisher: "Pulumi Labs", Homepage: https://github.com/pulumi-labs/<name>, and LanguageMap.java.basePackage: "com.pulumi.labs". Resulting build.gradle pom { ... } block has name = "", inceptionYear = "", and an empty developers { developer { id="" name="" email="" } }. closeAndReleaseSonatypeStagingRepository against Sonatype Central fails with "Project name is missing".
Workaround
String-surgery the generated build.gradle post-codegen to fill name. Tracking-only until this is fixed upstream.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in pkg/codegen/java/templates_gradle.go at newGradleTemplateContext and review the isPublishedByPulumi gate, then inspect pkg/codegen/java/package_info.go and the LanguageMap.java fields. Reproduce the schema with Publisher "Pulumi Labs" and basePackage "com.pulumi.labs"; done means the generated POM has identity and developer metadata while retaining the explicitly requested groupId.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100