ben-manes / gradle-versions-plugin

Gradle plugin to discover dependency updates
Apache License 2.0
3.82k stars 199 forks source link

Support gradle versions api url customization #807

Closed sebek64 closed 10 months ago

ben-manes commented 10 months ago

Can you put provide context? Do you have an example of an alternative url, since it is a custom api? Offhand I can’t think of a reason to make this customizable.

sebek64 commented 10 months ago

Thanks for quick reaction.

Yes, the context is maybe a bit non-standard. We want to run this task in a nightly-build runner, which has no direct internet access. So far, we had a proxy, but the next generation of runners have only custom artifactory access, with explicit proxied/mirrored urls. So the real url is mapped to a different one.

In the gradle wrapper properties file, this type of customization is supported, as well as in some other plugins (see for example gradle owasp dependency check plugin and many of its url parameters: http://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html).

Anyway, it is not an essential feature. If you decide not to merge it, we'll just script it differently, without any big effort.

If you're convinced by the use case, but you want some adjustments in the PR, I'm willing to do that.

ben-manes commented 10 months ago

thanks, that seems more reasonable. You'd need to fix the broken tests, maybe add one if possible, and include a one-liner in the readme about the config.

sebek64 commented 10 months ago

I've fixed the failing tests and tuned README. I was thinking about how to write a new test - how to mock the gradle service on an alternative url. There are more ways. One is to start an embedded http server in the test. An alternative can be to put some file to this repo, and refer to this file on github.

It is up to you to chose the right way or suggest another one. Or if we can survive without a test.

ben-manes commented 10 months ago

it looks like a large refactoring would be required to mock it with a file, even though that is quite convenient (like we do with the maven repository). Perhaps less so to spin up an http proxy, but that might feel like cumbersome busywork or be flaky. This seems like a small enough change that it's not super important to test more than what we already have, so I'm fine merging as is. We can release it when the tests pass or whenever you're ready to use your enhancement.

ben-manes commented 10 months ago

releasing, should be in the plugin repository in a few minutes.

sebek64 commented 10 months ago

Thank you, looking forward.

ben-manes commented 10 months ago

and it's live. Thanks for the contribution!