TheCoder
TheCoder

Reputation: 8913

Intellij Error: Internal caches are corrupted or have outdated format

I am getting an error intermittently when I build my Java project in Intellij.

Internal caches are corrupted or have outdated format, forcing project rebuild: java.io.FileNotFoundException: C:\target\classes\ehcache.xml (Access is denied)

I have run File->Invalidate caches. I have restarted Intellij and killed all Java processes. I eventually get it to build again but not sure what thing I try does the trick.

When I try to access the 'Target' folder, it says Access Denied.

Anyone seen this before?

Upvotes: 5

Views: 17363

Answers (8)

Javeria Ashraf
Javeria Ashraf

Reputation: 1

Nothing worked out for me, not even updating IntelliJ. However I found a solution, in the Project Structure -> Project Settings -> Modules -> Module SDK was set as 1.8 and I changed it to open-jdk21(That was used in all other modules).

Upvotes: 0

Pooja Ruhal
Pooja Ruhal

Reputation: 5

I had the same problem in Intellij 17 version for Mac. Rebuilding the project, changing the directory of the project, cleaning the module, and running IntelliJ 17 with admin mode did not work.

Updating Intellij to 2019 version solved the error. It seems the application was not able to get the admin permissions.

Upvotes: 0

Heath Borders
Heath Borders

Reputation: 32117

Similar to pdinklag's answer, I had to delete my user-level Android Studio caches to get rid of this error. However, Android Studio caches are stored in ~/.android/.

I shut down Android Studio, then ran:

cd
rm .android/cache build-cache build-cache.lock

Then restarted Android Studio, and things worked.

Upvotes: 0

Martin Bamford
Martin Bamford

Reputation: 404

I had this exact problem, I tried all of the above solutions but none of them worked for me.

The I tried the oldest one in the book (ie rebooting my laptop) and that fixed everything!

Upvotes: 0

Uncle Iroh
Uncle Iroh

Reputation: 6045

Tried all the above, but none worked for me. Finally running Intellij 14 in admin mode did the trick.

Upvotes: 0

Piper
Piper

Reputation: 1273

For me, I just had to clean all modules (and ensure they didn't require sudo permission), and rebuild.

The File->Invalidate Caches/Restart... did not work for me.

Upvotes: 1

pdinklag
pdinklag

Reputation: 1260

As mentioned in my comment, I received the same message, but without any access right issues involved whatsoever.

It seemed to be some kind of confusion on IDEA's end. I was able to fix this by deleting the system directory in C:\Users\%USERNAME%\.IdeaIC13 (the path obviously depends on the IntelliJ IDEA version).

This stores all caches and indices among other things. I have to confess that I can't tell why exactly this helps, but it seems to be a rougher way to "invalidate caches" and it works. Your project history is not deleted this way, so you can practically continue working - just that all files have to be scanned again and all indices have to be rebuilt.

In any event, this was not an access rights problem at all.

Upvotes: 4

Morfic
Morfic

Reputation: 15508

If you can't access the folder have to either change the rights for the entire hierarchy starting from your project root folder as described here, or move your project to some other directory that you are allowed to access

Upvotes: 0

Related Questions