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

Grgit instance is null on Windows. #372

Closed
Angular-Angel opened this issue Sep 16, 2022 · 3 comments
Closed

Grgit instance is null on Windows. #372

Angular-Angel opened this issue Sep 16, 2022 · 3 comments

Comments

@Angular-Angel
Copy link

Angular-Angel commented Sep 16, 2022

So I'm using the grgit gradle plugin to download stuff for my build script, right? And it works fine on Linux, for me and another person. But, when my friend runs it on Windows, he gets:

Execution failed for task ':buildModuleDevilUtil'.
> Cannot invoke method open() on null object

Which I'm pretty sure corresponds to line 34, where I go: def repo = grgit.open(dir: moduleDir).

Error Log.txt

@Angular-Angel Angular-Angel changed the title grgit instance is null on Windows. Grgit instance is null on Windows. Sep 16, 2022
@SmashMaster
Copy link

System Info

@ajoberstar
Copy link
Owner

The grgit variable is an instance of Grgit for the git repo the current Gradle project is inside. It will be null if it can't find a git repo in the Gradle project dir or one of its parents. Perhaps the Windows user has a copy of the source, but not in a Git repo.

However, the broader issue is that grgit.open() isn't an intended way to open a repository. You should instead be using it as a static method: Grgit.open(). I assume you were mislead by the documentation which provides the wrong example, so I'll fix that.

So the two changes would be:

  • Add an import for org.ajoberstar.grgit.Grgit
  • Change the call to use Grgit.open() instead of grgit.open()

@Angular-Angel
Copy link
Author

Ah, nice! Okay, Grgit works for me now. Thank you!

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

3 participants