ethrbunny
ethrbunny

Reputation: 10469

gradle - how does it decide which jar version to use?

I've created a one-off of a public domain library to use for testing. I built it and copied it to a server so the rest of my group can use it also. Unfortunately when I run ./gradlew build it's picking up the original version.

I set the compile line in build.gradle to have '+' for the version

How does gradle decide which version to include and how would I force it to use my updated copy?

Upvotes: 1

Views: 199

Answers (1)

David M. Karr
David M. Karr

Reputation: 15205

Assuming the original version is 2.0, and your version is 2.1, and the dependency spec refers to "2.0.+" (or some variation of that), it's going to take the FIRST artifact that matches that version expression. You may think it means to find the "largest", or somehow to know that it should get your version, but that's not what's happening here.

In short, set the dependency to a specific version.

If you have non-standard repositories, read the "Repositories" section of the Gradle User Guide for information on how to configure that: https://docs.gradle.org/current/userguide/dependency_management.html#sec:repositories .

Upvotes: 2

Related Questions