-
Notifications
You must be signed in to change notification settings - Fork 200
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
Bad resolution for BOM-style dependencies #97
Comments
You can inspect what Gradle and the task is doing using the The An example project with the bugs that I could play with would be helpful. |
It looks like the mavenBom plugin using |
Thanks @ben-manes. In case of Spring, the logs don't tell me much. Clearly, the fact that I'm using their snapshot and milestone repositories, together with Spring's custom convention you mentioned, causes the plugin to report 1.4.0.M1 as the latest release version. However, I want to keep using those repositories, as I like to play with new features they release and occasionally change my dependency version to a SNAPSHOT one. In terms of the AWS dependency, logs tell me quite nothing - all I see is the plugin finding a locally available resource with matching checksum. Does the plugin not check with remote repositories every time and cache those checks? Can we force it to hit the repositories every time? Sample with additional Spring repos is below. I've added a Jackson dependency to have a "regular" one in there.
|
You can force Gradle to skip its cache by using |
I just fixed the sample - for whatever reason, I omitted the Great, will use that and look at the logs. |
Logs say:
Do you know what the |
Probably its from the HTTP header. The dependencyUpdates task should be printing out its own log information of what its getting, so that's what I would be looking at to see why it is obtaining the wrong versions. |
There's actually not much more in the logs... |
I tried running your example. It looks like the mavenBom is doing a lot of magic and confusing anyone else inspecting the dependencies. For example it rewrites
So the dependencyUpdates task reports the local one as 2.6.5 even though perhaps you expected 2.6.3. This rewriting may be confusing the AWS listing as I see,
and my plugin is printing out,
indicating that the maximum resolution for a All the dependencies declared as So the big issue seems to be that the mavenPom plugin restricts anyone else trying to query artifacts by forcing them to the BOM's version. I haven't used BOMs before, so perhaps that is their intended purpose. If it is, then its intentionally incompatible. |
Thanks for the walkthrough, I have a bigger picture now. |
From their README,
That indicates the incompatibility is the desired capability of this plugin. An option might be to scope the BOM to the desired configurations. The restrictions may (or may not) apply due to using |
All experiments I've tried can't bypass this plugin, as it applies itself to all project configurations. The buildscript output is expected since it doesn't restrict those configurations. @wilkinsona please advise if there is any way to make our plugins compatible. |
The intention of a bom is to force the versions of a project's dependencies to match those declared in the bom.
That's not strictly accurate. The dependency management plugin uses beforeResolve to gather information about dependency versions, but versions are not set until the plugin's resolution strategy is called. I wonder if there could be an ordering issue here? @ben-manes when does your plugin perform its inspection of the versions? |
I had a bit more time so I've looked at this plugin's code a little, as well as re-reading the above. As I result, I think I may now have a better understanding of the problem. Am I correct in thinking that the problem is that the The dependency management plugin actually had the same problem at one point due to resolution strategies being copied over when a copy is made of a Another option would be to make a change to the dependency management plugin and have it ignore dependencies with |
The original version of this plugin used a detached configuration and Unfortunately over time that approach had numerous issues, some due to the plugin and others by Gradle bugs. For example, when resolution strategies were added to Gradle some users expected them to be honored by the dependency report. Another is that copying over repositories turned out to be error prone because The only safe, reliable, and forward looking approach was to copy the configuration. Then I clear out and rewrite the associated dependencies because that works. As some users want a to filter the dependency report (e.g. ignore betas) but not use that constraint globally, I added the ability to attach a custom resolution strategy. I'm hesitant to go back to a detached configuration as I think it might re-introduce bugs or cause more problems. I think you're right that it would avoid the conflict, but arguably that is an intended behavior if we are to honor their configurations. I'd rather see if your idea of ignoring |
I've started working on spring-gradle-plugins/dependency-management-plugin#77. The idea of ignoring dynamic versions ( As shown above, the dependency management plugin allows a dependency to be declared without a version. The snag is that this plugin replaces the null version with Considering the sample from @the4yeast, the end result is that this plugin continues to report that
It does, however, report that a later version of
As I said above, I don't want to treat |
A dependency without a version is commonly a local file dependency. These are common in Android projects. It might be confusing to assume it is therefore the latest? Or perhaps not assuming that the coordinates wouldn't match a remote dependency? |
Perhaps you could ignore local file dependencies entirely by checking to see if each |
Users would expect to see them in the report, but we could treat them differently if that helps? I'd be fine making a |
Yes, that would help. Thanks. The dependency mangagement plugin could/should be ignoring |
@wilkinsona any idea when spring-gradle-plugins/dependency-management-plugin#77 might be released in a build? thanks for the enhancement! |
@the4yeast It's available in 0.6.0.BUILD-SNAPSHOT builds now. You can get those from https://repo.spring.io/plugins-snapshot. All being well, I suspect that 0.6.0.RELEASE will be released in the next week or so. |
thanks @wilkinsona |
Using @the4yeast example, @wilkinsona's latest release and his requested changes, the update report comes out properly. Note that I had to check
@jochenberger Can you please perform the release (0.13.0)? |
Sounds awesome, thanks a lot gentlemen! |
|
It looks like there's an issue with dependencies declared as
mavenBom
, e.g.In my case, the version is 1.10.56, whereas 1.10.62 is the most recent one at time of writing. I'm almost sure that the plugin stopped reporting newer versions of this dependency when I switched to the BOM style.
Also, not explicitly a BOM, but it works in a similar manner - Spring Boot dependency.
The plugin is imported and appliesjust like any other plugin:
with my current version being 1.3.3.RELEASE. Dependencies are added without versions, e.g.
compile('org.springframework.boot:spring-boot-starter-web')
.The plugin (when executed with
-Drevision=release
) now reports 1.4.0.M1 as the latest release version of the plugin, but correctly indicates that 1.3.3.RELEASE is the latest release version of each dependency.As much as the Spring Boot issue is not a big problem - the dependencies themselves are reported correctly - the AWS SDK issue is causing some inconvenience.
The text was updated successfully, but these errors were encountered: