How to skip version mapping in maven-publish plugin?

Hi,

TL;DR
Since my generated pom has dependencyManagement section, I want to skip version tag in individual dependencies.

I am migrating from legacy maven plugin to maven-publish plugin and having issue with the version of dependencies. I am using spring dependency-management plugin and skipping the version for the dependencies in build files. The plugin will generate dependencyManagement section in the generated pom file and therefore I don’t need the version tag in dependencies. But I didn’t find any configuration in versionMapping to skip the version resolution for the dependencies and simply convert the build file dependencies to pom dependencies. Is there any way to do that?

To start with, you should not use the Spring dependency management plugin.
It is mainly a left-over from a time where Gradle had no built-in POM support.
Nowadays you should just use the built-in functionality for consuming POMs with platform(...).
And iirc, if you do so, the generated POM should also be like you want it I think.

@Vampire This is a legacy project with many modules. It’s not easy to make so many changes at a time and moving away from spring dependency-management is not possible at the moment. All i need is to tell maven-publish plugin to ignore missing versions in the deps.

Hello,

There is no such option in the maven-publish plugin.

For the POM you could do manual manipulation, but then it is inconsistent with the Gradle Module Metadata also published unless you suppress it which you shouldn’t.

Moving from Spring dependency management plugin to the built-in BOM support should more or less be a drop-in replacement, so shouldn’t be too much of a problem to migrate.