Skip to content

Silence the pkl-gradle pom metadata warning - #1840

Open
HuzaifaChaudary wants to merge 1 commit into
apple:mainfrom
HuzaifaChaudary:fix/suppress-pkl-gradle-pom-metadata-warning
Open

Silence the pkl-gradle pom metadata warning#1840
HuzaifaChaudary wants to merge 1 commit into
apple:mainfrom
HuzaifaChaudary:fix/suppress-pkl-gradle-pom-metadata-warning

Conversation

@HuzaifaChaudary

Copy link
Copy Markdown

Closes #1743

the warning

every publish of pkl-gradle prints:

> Task :pkl-gradle:generatePomFileForPluginMavenPublication
Maven publication 'pluginMaven' pom metadata warnings (silence with 'suppressPomMetadataWarningsFor(variant)'):
  - Variant runtimeElements:
      -  contains dependencies that cannot be represented in a published pom file.
          - dependency on project ':pkl-tools' declared with Gradle attributes

it comes from the deliberate declaration in pkl-gradle.gradle.kts:

runtimeOnly(projects.pklTools) {
  attributes { attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.SHADOWED)) }
}

a pom has no way to express a variant attribute, so gradle warns that it is dropping one.

why silencing is the right answer here rather than papering over

i checked what is actually lost before suppressing anything.

the pom still declares the dependency. it is not missing, only the variant selection is:

<dependency>
  <groupId>org.pkl-lang</groupId>
  <artifactId>pkl-tools</artifactId>
  <version>0.33.0-SNAPSHOT</version>
  <scope>runtime</scope>
</dependency>

the module metadata keeps the attribute:

variant runtimeElements -> pkl-tools attributes: {'org.gradle.dependency.bundling': 'shadowed'}

and only gradle consumes a gradle plugin. the warning itself says the module file is unaffected, and that is the file gradle reads. there is no maven build resolving pkl-gradle as a library, so the pom limitation has no consumer to hurt.

so the information gradle is warning about is genuinely not needed by anyone who consumes this artifact, which is the case suppressPomMetadataWarningsFor exists for.

verification

check result
warning before present
warning after gone
generated pom before vs after byte identical
module metadata after still carries bundling: shadowed

the diff is ten lines in one file and changes nothing that gets published.

built and verified against main at 1208fa9 with the repo's own gradle toolchain, jdk 25.0.2.


disclaimer: this contribution was prepared with the assistance of an ai agent. i reproduced the warning first, diffed the generated pom to confirm the published artifact is unchanged, and checked the module metadata myself before opening this.

the runtimeOnly dependency picks the shaded pkl-tools variant with a gradle
attribute and a pom cannot express that, so every publish prints a warning
about information being lost

only gradle consumes a gradle plugin and the module metadata still carries the
attribute, so nothing is actually lost. the generated pom is byte identical
before and after, the warning is the only thing that goes away
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning during publish: 'Maven publication 'pluginMaven' pom metadata warnings'

1 participant