Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When exactly is .gradle folder created in the home directory in Linux?

Tags:

linux

gradle

Okay so when exactly does gradle begin downloading dependencies? And when exactly is .gradle folder created in the home directory.

like image 998
Smrita Avatar asked Jul 12 '14 09:07

Smrita


People also ask

What creates the .gradle folder?

A . gradle folder is always created when running gradle in a directory, unless there is a settings.

Where is .gradle folder located?

The top-level build file The top-level build.gradle file, located in the root project directory, defines dependencies that apply to all modules in your project. By default, the top-level build file uses the plugins block to define the Gradle dependencies that are common to all modules in the project.

What is the .gradle directory?

The Gradle user home directory ( $USER_HOME/.gradle by default) is used to store global configuration properties and initialization scripts as well as caches and log files.

What is .gradle folder in user?

gradle directory is to try and keep the build process all contained in one location (e.g. if the app project files are on another drive). On some Windows computers the C: drive may be low on space. This means programs and files may need to be installed and run from another drive.


2 Answers

Gradle downloads dependencies just-in-time when they are first used. ~/.gradle is used for many purposes, and may be created as soon as Gradle is first started.

like image 144
Peter Niederwieser Avatar answered Sep 28 '22 11:09

Peter Niederwieser


When talking about dependencies in gradle, you can categorize them into 2 categories :

  • build script dependencies : the gradle-plugins required by your script (for instance the android-gradle-plugin when you are building an android project). Those dependencies are downloaded at the very first stage of the gradle process.

  • project dependencies : downloaded when they are required. (i.e. if you are building only part of your project: it is possible that some dependencies not required for this part aren't downloaded)

There is a third kind of download : when you use the gradle-wrapper : gradle it-self can be downloaded by the wrapper-script (and of course it is the very first download.)

Regarding the ~/.gradle : it is the GRADLE_USER_HOME (by default USER_HOME/.gradle) : it can be redefined in multiple ways (see here) and it is used as soon as a gradle process is started.


EDIT

A gradle process is started as soon as you run a command starting with gradle <with args> in a directory where a build.gradle exists (note that if you use the wrapper : the command is gradlew <with args>) .

When using an IDE (like Android Studio or IntelliJ) : the IDE can start a gradle process for you. In Android-Studio (or IntelliJ) : there is a view named Gradle Console where you can see logs issued by any gradle process started by the IDE.

like image 45
ben75 Avatar answered Sep 28 '22 09:09

ben75