alx3apps / jgit-buildnumber

Git buildnumber for Maven and Ant without Git CLI
51 stars 23 forks source link

java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called. #7

Closed dkokic closed 12 years ago

dkokic commented 12 years ago

ant script invoked from a custom eclipse builder:

``` simple example build file Here we go ... Git version extracted ${git.commitsCount} (${git.shortRevision}) ```

The mentioned exception is noted in JGit project, but should have been fixed long time ago.

alx3apps commented 12 years ago

dkokic, this exception is reported by JGit if provided repositoryDirectory directory doesn't contain Git repository. But it seems jgit doesn't like paths like foo/.., so I added canonicalization of provided path before giving it to jgit. It was added to 1.2.6 version, binaries will appear in maven central shortly, before that you can download ant task here

dkokic commented 12 years ago

Thank-you for your help. Actually, it was my mistake (I used ant.home instead of basedir). Both 1.2.5 and 1.2.6 works as expected.

gnh1201 commented 7 years ago

Additional Information:

Article: Gradle troubleshooting: One of setGitDir or setWorkTree must be called (grgit)

https://gnh1201.wordpress.com/2017/03/23/gradle-troubleshooting-one-of-setgitdir-or-setworktree-must-be-called-grgit/