how do I correct pom metadata when using the gradl...
# community-support
c
how do I correct pom metadata when using the gradle publish plugin.
Copy code
GRADLE_PUBLISH_KEY="a" GRADLE_PUBLISH_SECRET="a" ./gradlew publishPlugins --validate-only
Calculating task graph as no cached configuration is available for tasks: publishPlugins --validate-only
Maven publication 'pluginMaven' pom metadata warnings (silence with 'suppressPomMetadataWarningsFor(variant)'):
  - Variant apiElements:
      -  contains dependencies that will produce a pom file that cannot be consumed by a Maven client.
          - org.jspecify:jspecify:0.+ declared with a Maven incompatible version notation
          - org.semver4j:semver4j:5.+ declared with a Maven incompatible version notation
I'd do
Copy code
versionMapping {
        allVariants {
          fromResolutionResult()
        }
      }
but that's not availble in the gradle publish plugin
v
I'd say you have three options. 1. Why do you care? How likely is it, that a Maven client will consume a Gradle plugin? While publishing dependencies on version ranges is not really good practice of course. 2. Instead use a version range that is compatible with Maven like
[0.0,)
and
[5.0,)
, while again publishing dependencies on version ranges is not really good practice. 3. Use what you just said. The Plugin Publishing plugin auto-applies the
maven-publish
plugin since its version 1.0.0 and you just use the normal ways to interact with it like you showed.
c
I've tried dealing with a maven publish plugin, I still get the messages. It's configuration isn't being picked up or something? I don't understand how the two plugins are interacting
To be honest I don't really care, but then I don't really understand why I'm getting that message and the suppression is also on the same maven plugin that doesn't seem to be recognizing its configuration
v
Don't create a new publication, but configure the publication the plugin added for you.
c
how do I do that?
v
Configure the
pluginMaven
publication that the Java Gradle Plugin plugin added for you.
c
is that a name of a publication?
v
yes
c
Publication with name 'pluginMaven' not found.
v
Can you push your state to some branch?
v
Seems it is just added later. Use
Copy code
withType<MavenPublication>().matching { it.name == "pluginMaven" }.configureEach {
  // ...
}
instead of
named
c
cool, thanks
👌 1