J Fabian Meier
J Fabian Meier

Reputation: 35795

Gradle: Resolve a given jar from a specified repository

For a gradle build (java project), I usually specify a set of repositories in which the dependencies are searched.

Is it possible to force gradle to take a given jar from a specified repository? I want to have a local configuration file which says something like "Take foo.jar from the local repository" and my gradle scripts reads this configuration file and does exactly this (while resolving the other dependencies "normally").

Upvotes: 4

Views: 903

Answers (2)

RaGe
RaGe

Reputation: 23657

Specifying different repo configuration per dependency is currently not possible with Gradle. This has been requested and discussed before. There is an open and unresolved Jira as well. Please also see:

1 2

Upvotes: 4

David Medenjak
David Medenjak

Reputation: 34532

Gradle will usually take the first repository it finds the file in, so if you add your local repository as the first item, it will load it from local.

You can read more about resolving of dependencies here.

Modules from earlier repositories are preferred over modules in later repositories.

You can always just add your dependency as a jar file to the project. In that case there is no further resolution.

Upvotes: 1

Related Questions