Is it possible to define lazily evaluiated version for maven-publish plugin?


I am trying to figure out how to write build script that will use lazily evaluated version in maven-publish plugin.

Is it possible? It looks like the version has to be String, so that it has to be evaluated at configuration time. I need the version to be evaluated at runtime, just before publishing happens.


I haven’t tried it myself, but does this work?

publishing {
    publications {
        pub( MavenPublication ) {
            version = "${-> your version string logic}"