Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cached versionProvider in configuration breaks version calculation #870

Open
piomar123 opened this issue Dec 3, 2024 · 0 comments

Comments

@piomar123
Copy link

I have tags including the branch name, e.g. release-main-1.2.3 or release-other-3.4.5 and I configured the plugin as below:

scmVersion {
    tag {
        prefix.set("release-${scmPosition.branch}-")
    }
 }

Unfortunately, the result of gradle currentVersion always results in Project version: 0.1.0-SNAPSHOT.

I finally found that accessing anything from the cached versionProvider (in this case scmPosition) in the configuration breaks the version calculation. The solution was to use the uncached provider:

prefix.set("release-${uncached.position.branch}-")

And this gives the correct currentVersion: Project version: 1.2.3

The problem is that this feature is not documented nor I could find any info about the issue with using the cached provider. Am I missing something?

I know about branchPrefix property but it feels too limiting.

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

No branches or pull requests

1 participant