2

I am working with Intellij Idea (CE)

  • 2020.2.3

And using Gradle 6.7

Path Variables

Where in the OS exists configured, the following about Path Variables in the bash profile:

  • GRADLE_HOME = /Users/username/.../gradle/6.7
  • GRADLE_USER_HOME = /Volumes/FP27072011/gradle/repository

How you can see, customized locations

The /Users/username/.gradle directory is empty.

About Intellij Idea, its configuration for Gradle is as follows:

enter image description here

Same paths as the bash profile.

Note

The following figures that represents the interaction with the IDE, are based on:

  • /Users/username/.gradle directory empty
  • /Volumes/FP27072011/gradle/repository directory empty
  • Working with spring-framework project based on Gradle

It to have a quick discard something around there.

Ok, startup process:

enter image description here

enter image description here

Starts to Sync

enter image description here

A Gradle's daemon is started

enter image description here

After of some seconds fails with:

enter image description here

The error message is:

Gradle could not start your build.
> Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal().
   > Timeout waiting to lock journal cache (/Volumes/FP27072011/gradle/repository/caches/journal-1). It is currently in use by another Gradle instance.
     Owner PID: unknown
     Our PID: 713
     Owner Operation: unknown
     Our operation: 
     Lock file: /Volumes/FP27072011/gradle/repository/caches/journal-1/journal-1.lock

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

The repository directory shows the following

enter image description here

The /Users/username/.gradle directory shows

enter image description here

Observation: Until this point observe in the two previous Figures that the daemon/6.7 path/directory appears twice in the repository and .gradle directories respectively

Note: When the IDE is closed, just in that moment, in the /Users/username/.gradle directory appears this new file (registry.bin.lock) as follows:

enter image description here

I got this behavior even if I delete the idea-directory-installation/.gradle directory (not /Users/username/.gradle directory) and even with Invalidating Caches/Restart

What is missing, what to do?

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
  • 1
    Did you disable antivirus as I advised in https://stackoverflow.com/questions/64861388/intellij-idea-2020-2-gradle-the-cache-entry-for-initialization-script-ijini ? – Andrey Nov 19 '20 at 08:22
  • 1
    Such problems happen when some other process locks the file. The could be problem with processes on your system cannot terminal(exit) properly and hanging locking the files. AV/firewall can cause such issues. – Andrey Nov 19 '20 at 08:23
  • This case is for a Mac, there is no an antivirus, here behaves better than in Windows. About the lock file: when the error is thrown just then in the console/terminal I just execute `gradle --status` and shows nothing, if I execute the same command when the IDE is building just show one daemon. Not sure what is happening – Manuel Jordan Nov 19 '20 at 13:51
  • Once I got resolved this scenario in Mac, I am going to return to Windows. – Manuel Jordan Nov 19 '20 at 14:04
  • 1
    It could be that some another process locks the file. Use `lsof` to check this https://apple.stackexchange.com/a/22265/362450 – Andrey Nov 24 '20 at 09:21

2 Answers2

0

You can check for other running Gradle processes and terminate them. In any system's shell put the following command:

ps aux | grep gradle

Then, kill the previously found Gradle processes using their pid (process identifier). For instance, if the found Gradle process has the pid 12345, the command would be this one:

kill -9 12345
kaleemsagard
  • 723
  • 6
  • 8
0

For this specific and explicit situation, the problem is about that the secondary storage (pendrive) does not have the same format type as the main storage (Hard Disk - HDD/SSD), for more information follow in order the following links:

Therefore as summary:

Scenario

Exists a Secondary Drive that is used how repository for Gradle

Solution

Format the secondary device with the same format type as the main hard disk has and problem solved!. I am not sure why this situation or behavior. Otherwise an error message about a .lock file exists arises and the daemon remains hanged

Consideration

I had this situation in 2 PC and the format types for each OS is different. Therefore this solution was applied to them and worked, macOS and Windows.

Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158