Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency resolution of preferred version doesn't work with source dependencies #25312

Open
tudortimi opened this issue Jun 6, 2023 · 1 comment

Comments

@tudortimi
Copy link

Expected Behavior

We're using a version range for a source dependency. We would also like to specify a preferred version. Gradle should clone the version specify by the preferred version.

Current Behavior

Currently, it seems that Gradle clones the newest version that satisfies the version range.

Context (optional)

No response

Steps to Reproduce

I've attached a Git repo for the dependency, called producer. This repo contains three tags, 1.0, 1.1 and 2.0.

I've also attached another Gradle project, called consumer, which uses the Git repo as a source dependency.

consumer has the following in its build.gradle:

dependencies {
  implementation('dummy:producer') {
    version {
      strictly '[1.0, 2.0)'
      prefer '1.0'      
    }
  }
}

We see Gradle cloning version 1.1, not the preferred 1.0 version.

To reproduce, download the two zips:
consumer.zip
producer.git.zip

unzip producer.git.zip
unzip consumer.zip -d consumer

cd consumer
gradle run

You should see Producing version 1.1.

Gradle version

6.7.1, 7.4.2, 8.1.1

Build scan URL (optional)

No response

Your Environment (optional)

No response

@tudortimi tudortimi changed the title Preferred version don't work with source dependencies Dependency resolution of preferred version doesn't work with source dependencies Jun 7, 2023
@jbartok
Copy link
Member

jbartok commented Jun 9, 2023

Thank you for providing a valid report.

The issue is in the backlog of the relevant team, but this area of Gradle is currently not a focus one, so it might take a while before a fix is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants