Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle local dependencies are not visible

Tags:

java

gradle

In my project I use some local dependencies:

dependencies {
    compile files('lib/mylib.jar')
}

Why when I call gradle dependencies I can't see this library as a dependency? Command gradle dependencies --configuration compile returns this:

:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

compile - Compile classpath for source set 'main'.
No dependencies

Dependencies downloaded from repository (maven/ivy) are visible. For example:

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.guava:guava:14.0.1'
}

will show:

:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

compile - Compile classpath for source set 'main'.
\--- com.google.guava:guava:14.0.1

BUILD SUCCESSFUL

I should also add that dependencies are not shown but project compiles properly.

like image 775
pepuch Avatar asked Jun 28 '13 07:06

pepuch


People also ask

Where are Gradle dependencies stored locally?

Gradle uses $USER_HOME/. gradle as the default directory to store its local cache.

How do I get dependencies in Gradle?

To add a dependency to your project, specify a dependency configuration such as implementation in the dependencies block of your module's build. gradle file. This declares a dependency on an Android library module named "mylibrary" (this name must match the library name defined with an include: in your settings.

How do I resolve Gradle dependencies?

Given a required dependency, with a version, Gradle attempts to resolve the dependency by searching for the module the dependency points at. Each repository is inspected in order. Depending on the type of repository, Gradle looks for metadata files describing the module ( .


1 Answers

Gradle documentation on file dependency explains

File dependencies are not included in the published dependency descriptor for your project. However, file dependencies are included in transitive project dependencies within the same build. This means they cannot be used outside the current build, but they can be used with the same build.

like image 63
Grzegorz Żur Avatar answered Sep 28 '22 06:09

Grzegorz Żur