Home > Net >  Gradle throws error org.gradle.launcher.GradleMain when cloning it using git submodule --init
Gradle throws error org.gradle.launcher.GradleMain when cloning it using git submodule --init

Time:07-20

I have private remote repository where are not only Java project, external dependencies, but also Gradle executables:

gralde and gradle.bat

are located. Before I clone the project I obtain external dependencies (Gradle as well):

git submodule update --init

I first time deal with this project and after I

git clone <project URL>

And proceed to the Gradle executable location and type:

./gradle -v

I get an errors:

Error: Could not find or load main class org.gradle.launcher.GradleMain

Caused by: java.lang.ClassNotFoundException: org.gradle.launcher.GradleMain

Colleague of mine, who has been working on this project couple months ago, after deleting the project and re-cloning it can successfully execute command:

./gradle -v

Second colleague, who's just like me has never been working on the project, tried to clone it and got same errors as I did.

However, when I tried to install Gradle (from gradle.org) on my PC and execute this command:

gradle -v

It executed sccessfully

This project don't assume you have Gradle pre-installed, nor Gradle config files, just raw git cloning should provide you with everything.

I thought maybe error in some ENV configuration, but after looking at mine and the colleague's where the Gradle works no special differences seen.

Any ideas where could hide a problem?? I saw a lot of resources, where mainly people suggest:

  1. configure $PATH (but this should not be the solution, since all stuff is coming from remote repo)
  2. configure build.gradle file (it could be a good solution, however, how does it work on my "first colleague's" PC and doesn't on mine (all files are downloading at cloning)

So, I have no idea... Where is the problem? Is it still ENV problem or what?

CodePudding user response:

If you feel that no ENV issues could cause it, I would suggest to try this:

apt install git-lfs

This is not official Git "plugin", but it helps to handle large files, like video, audio, third-party libraries (your case) sometimes if your Git uses LFS it could cause problems when cloning the project

Ref: https://git-lfs.github.com/

UPD:your steps could look like:

a) apt install git-lfs

b) git clone ...

  • Related