Why you see it in IntelliJ but not in your project folder


 


Why you see it in IntelliJ but not in your project folder


IntelliJ shows all dependencies under External Libraries, but they are not stored directly inside your project directory. Instead, they are downloaded and cached by your build tool (like Gradle or Maven) in a global location on your system.

~/.gradle/caches/modules-2/files-2.1/
~/.m2/repository/

You have a Maven project that uses a:1.2 → it downloads the JAR to ~/.m2/repository. Now, in a Gradle project, you also want to use a:1.2


What actually happens:

Gradle does not use Maven’s .m2/repository directly.

Instead: Gradle will check its own cache:

~/.gradle/caches/modules-2/files-2.1/

If a:1.2 is not found in Gradle's cache, it will:

Download a:1.2 from the remote repository (e.g., Maven Central) again.

Store it in the Gradle cache, not reuse from .m2.


Why this happens:

Gradle and Maven use different caching strategies and metadata formats, so they maintain separate repositories.


BUT: You can configure Gradle to look into your .m2 repository, like this:

repositories {
mavenLocal()
mavenCentral()
}

If the dependency is found there → it will copy it into Gradle’s own cache.

Comments

Popular posts from this blog

Database - Topics

02. Spring – Creating spring project clone it with GIT step by step.