Home > Net >  facing issue with gradle git zoltu plugin?
facing issue with gradle git zoltu plugin?

Time:08-30

I am using below plugin for managing the patch version automatically.

id "com.zoltu.git-versioning" version "3.0.3"

Basically the above plugin requires code to be taged using v.major.minor convention. So, I have tagged the code with v0.1 and the tag is reachable form the HEAD.

But still I am getting below error -

  • What went wrong: A problem occurred evaluating root project 'report-service'.

Your repository must have at least one tag in it for git-versioning to work. Recommended solution: git tag v0.0

and git tag shows there is a tag and i have checked the revision history and this tag is reachable from the branch I am working on -

$ git tag
v0.1

Does anyone have any clue what the issue is. This a blocker for me.
Thanks in advance for any help..

CodePudding user response:

This actually comes from Zoltu/Gradle.Plugin.Versioning kotlin/com/zoltu/gradle/plugin/GitVersioning.kt

    private fun getGitDescribeResults(rootDirectory: File): String {
        val repository = FileRepositoryBuilder()
                .findGitDir(rootDirectory)!!
                .apply { gitDir ?: throw Exception("Project must be in a git directory for git-versioning to work.  Recommended solution: git init") }
                .build()!!
        val git = Git.wrap(repository)!!
        if (git.repository.allRefs.count() == 0) throw Exception("Your repository must have at least one commit in the repository for git-versioning to work.  Recommended solution: git commit")
        return git.describe().setLong(true).call() ?: throw Exception("Your repository must have at least one tag in it for git-versioning to work.  Recommended solution: git tag v0.0")
    }

As noted by torek in the comments, check if your tag is lightweight or annotated.
git describe would by default ignore lightweight tags.

  • Related