[GRADLE-1322] Don't search for unused source and javadoc dependencies Created: 19/Jan/11  Updated: 04/Jan/13  Resolved: 05/Nov/11

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: 1.0-milestone-6

Type: Improvement
Reporter: Joe Schmetzer Assignee: Daz DeBoer
Resolution: Fixed Votes: 2


I have a project with a large number of dependencies in the build file. The dependencies have been configured to come from a local installation of Nexus, which will then proxy various external repos as well as our own hosted repositories.

Often, when running a simple task (or just calling "gradle depenencies"), gradle will pause for a very long time (often up to 5 minutes) while it displays messages about retrieving various pom files for other internal projects. It seemed an unusually long time to pause, so I started wireshark to see what was happening: it appears that for every jar file we depend on, gradle will also do a HTTP HEAD request on various associated artifacts. For example, to retrieve a
jar called DataType, the following requests are made:

HEAD /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94.pom HTTP/1.1
GET /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94.pom HTTP/1.1
HEAD /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94.jar HTTP/1.1
HEAD /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94-sources.jar HTTP/1.1
HEAD /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94-src.jar HTTP/1.1
HEAD /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94-javadoc.jar HTTP/1.1
GET /nexus/content/groups/public/com/example/DataType/1.0.94/DataType-1.0.94.jar HTTP/1.1

The problem is that DataType-1.0.94-sources.jar, DataType-1.0.94-src.jar and DataType-1.0.94-javadoc.jar do not exist. Because gradle requested them, Nexus realises that it doesn't have them locally, and then searches the external repositories for them, which takes a long time (sometimes up to 10 seconds). Multiple this by about 20 different dependencies, this adds an enormous amount of time to what I would have expected to be a quick task.

Gradle should not be requesting the "-sources", "-src" and "-javadoc" artifacts when it doesn't need them.

Generated at Wed Jun 30 11:52:37 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.