Hunt strategy change for Maven repos is not how build systems which use Maven repositories behave #25461
-
How are you running Renovate?Mend Renovate hosted app on github.com If you're self-hosting Renovate, tell us what version of Renovate you run.No response If you're self-hosting Renovate, select which platform you are using.None Was this something which used to work for you, and then stopped?Placeholder value, please select the correct response from the dropdown Describe the problemThis ticket and this PR changed the strategy of resolving Maven dependencies from 'merge' to 'hunt'. The citation on the issue is that is how Maven (the build tool) purportedly behaves. This is describing how full Maven coordinate triples are resolved, not which versions are available in a repo, and as a result you are now going to miss dependency updates from artifacts which changed their Maven repo host. Take, for example, the official Android Gradle plugin artifact whose coordinates are The majority of artifacts an Android developer will consume come from Maven Central and so it usually appears first in the repo list. This ensures two things:
As a result of this change, many repos stopped seeing updates. For example, here's a PR that got a new version before the above change was deployed. And here's a Dependency Dashboard whose job ran after the deploy and thus seems stuck on 8.1.1 despite 8.1.2 being out. The Renovate job for that repo shows that it only checks Maven Central and never the Google Maven repo:
If I manually bump the version to 8.1.2, the build will successfully resolve the artifact. This is because Gradle will attempt to fetch it first from Maven Central and fail, it will then move on to Google Maven, my second configured repo, and attempt there. Ultimately, when I read the Maven build tool link referenced in the original ticket I actually think this change is in error. Because that documentation is detailing the behavior when resolving a Maven coordinate triple (i.e., a groupId and artifact with a version). It is not detailing how it resolves the You can reproduce this with a repo that contains a single apply plugin: 'java'
repositories {
mavenCentral()
google()
}
dependencies {
implementation 'com.android.tools.build:gradle:8.1.1'
} Note that this project builds (by running I made a minimal reproducer for the Maven build tool as well. Put the following into a <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>maven-central</id>
<url>https://repo1.maven.org</url>
</repository>
<repository>
<id>google-maven</id>
<url>https://maven.google.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.android.tools.build</groupId>
<artifactId>gradle</artifactId>
<version>8.1.1</version>
</dependency>
</dependencies>
</project> This project also builds (using Both of these projects when run with Renovate will not see the 8.1.2 upgrade. However, manually bumping the dependency to 8.1.2 will successfully build in both. With this, I hope that I've convinced you that the linked commit above should be reverted, or at least changed to a strategy which honors full coordinate triples in the first Maven repo they're found in, but still checks all Maven repos for those sets of triples. Relevant debug logsNo response Have you created a minimal reproduction repository?I have linked to a minimal reproduction in the description above |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 22 replies
-
We may need a more complex approach than simply changing mergeStrategy from hunt to merge. One challenge was that Renovate in many cases was searching non-Maven Central repositories unnecessarily, leading to increased search times, increased load on that server, etc. What would be the solution in that case? e.g.
Cc @Churro |
Beta Was this translation helpful? Give feedback.
-
Hunt strategy was also causing conflict with release/snapshot repositories order : #25294 Thanks for the revert |
Beta Was this translation helpful? Give feedback.
-
@rarkins I recently discovered this ticket after observing item 1. of the opening post in one of my debug logs (self-hosted renovate). I don't see that addressed in the context of this ticket. Any plans on fixing up hammering Maven Central with lots of useless requests? The IS NO index.html, there is an HTML-page 'directory listing' served if you browse the folder location, so the E.g. That is... to resolve item 1. at 'index.html' should be changed to '' to retrieve the package index page from Maven Central.
|
Beta Was this translation helpful? Give feedback.
-
Locking this as I'd like any new discussions on the topic to be in a new github discussion |
Beta Was this translation helpful? Give feedback.
We plan to release it in v37 instead: #26013