Issue
Say I want to retrieve with graddle the dependancy tree of this artifact : com.google.firebase:firebase-firestore:24.4.0
How can I do ?
Solution
You can't do that, An aar does not contain any dependency information by itself.
All the information of this aar is stored in pom.xml which can be found here over google maven repo.
And this will only show you what Gradle dependencies
command will do, and those are the transitive dependencies meaning the direct dependencies for this aar, Which By default, Gradle resolves them automatically.
the pom.xml
for com.google.firebase:firebase-firestore:24.4.0
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-firestore</artifactId>
<version>24.4.0</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>androidx.annotation</groupId>
<artifactId>annotation</artifactId>
<version>1.1.0</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-base</artifactId>
<version>18.0.1</version>
<scope>compile</scope>
<type>aar</type>
</dependency>
</dependencies>
<name>firebase-firestore</name>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
</project>
This pom.xml
include com.google.android.gms
which has its own pom.xml
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-basement</artifactId>
<version>18.1.0</version>
<packaging>aar</packaging>
<dependencies>
<dependency>
<groupId>androidx.collection</groupId>
<artifactId>collection</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>androidx.core</groupId>
<artifactId>core</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
<type>aar</type>
</dependency>
<dependency>
<groupId>androidx.fragment</groupId>
<artifactId>fragment</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<type>aar</type>
</dependency>
</dependencies>
<name>play-services-basement</name>
<licenses>
<license>
<name>Android Software Development Kit License</name>
<url>https://developer.android.com/studio/terms.html</url>
<distribution>repo</distribution>
</license>
</licenses>
</project>
What I am trying to say, Is that unless you iterate the process and fetch the POM files of the dependencies yourself, with a custom task, All you can use is gradle dependencies
command to check the transitive dependencies used by your project or module.
UPDATE:
You can easily start a new gradle project by following these simple steps.
mkdir gradleExp
cd gradleExp
gradle init
# 1.basic 1.groovy random name- update the empty
build.gradle
with the following
plugins {
id 'java'
}
repositories {
google()
mavenCentral()
}
dependencies {
implementation "com.google.firebase:firebase-firestore:24.4.0"
}
gradle dependencies
# to list allgradle dependencies --configuration compileClasspath
# reduce output to show only Compile classpath for source set 'main'
NOTE: missing either google()
or mavenCentral()
will show some failure in the result shown.
Answered By - George
Answer Checked By - Timothy Miller (JavaFixing Admin)