[Enhancement] Allow override of repository url (mavenCentral/jcenter) url

Hi,

I would like to be able to override value for DefaultRepositoryHandler.BINTRAY_JCENTER_URL and ArtifactRepositoryContainer.MAVEN_CENTRAL_URL in my ~/.gradle/gradle.properties (or any other configuration file at user level)

Use case : force usage of a an artifactory (or nexus) server at least for default repository without modifying the build itself.

Or better : allow a repository url override configuration file. To be able to remap any declared repository externally to the buildfile itself : eg of possible file content :
https://jcenter.bintray.com https://ourartifactory:6666
https://foom2repository/here https://ourartifactory:6666
http://notsogoodrepository https://oursonatypenexus

Thanks.

This sounds very similar to configuring mirrors with Maven. You could use this plugin to get some of this functionality (although requiring a settings.xml file). Take a look at the implementation for an example of how you could do something like this yourself, perhaps in an init script.

Hi Mark,

Yes it’s almost like maven’s mirrors. I like your plugin and it’s almost what I need.

But here, I would like to see a such feature integrated into gradle so no modification of any buildfile is needed.
Juste checkout any project, run gradlew, and have the repositories url override behavior applied.

Thanks.

There are no plans to add such a capability to Gradle core at this time. I think your best bet would be to add such logic in an init script which would allow you to avoid modifying your project’s build scripts.

Is there no plan because you don’t want to allow users to do such things, or there is no plan only because it’s not a priority ? (In other word, If I try to make a PR to add such feature to gradle and if the quality of the contribution is ok according to gradle’s standard, there is chance that my PR will be accepted ?)

My opinion is because there is already a solution for this use case (init script) I’m not sure we want to expose some magic properties specifically for this purpose. I would suggest you bring this up on the gradle-dev mailing list before submitting a PR.