build: centralize maven repo declarations - #4677
Conversation
| repositories { | ||
| if (mirrorUrl) { | ||
| maven { | ||
| name = 'enterpriseMirror' |
There was a problem hiding this comment.
Does enterpriseMirror mean something or does it just need a string? If the latter then IMO "enterprise" has a certain commerce/profit-making connotation which is probably correct in most cases but in the off chance it is not (non-profit/government) maybe we dont have to be so opinionated on this being an "enterprise" mirror. But enterprise is an overloaded term in java so thats a really small nit.
There was a problem hiding this comment.
It's any name. I'll see if I can remove it. I think of "enterprise" as your business, no matter it's nature.
There was a problem hiding this comment.
it can be removed but seems a best practice / helpful. I'll leave it commented and put "yourEnterpriseMirror"
|
Will merge this tomorrow. |
This reverts commit 5d1cb9c.
|
I validated this at work -- a build that occurred in a docker container. Disclaimer: did so with several modules disabled like the UI and jsClient. Thus I didn't need NodeJS. Some more adjustments might be needed to accommodate that. |
Centralize repository declarations (single mirror choke-point)
Motivation
Repository declarations (
mavenCentral(),gradlePluginPortal()) were scatteredacross the build in every distinct Gradle repository scope: plugin resolution,
project dependencies, the buildscript classpath of several convention scripts, and
the two included builds. There was no single place for an enterprise to redirect
resolution to an internal mirror (Artifactory/Nexus).
What this does
Introduces one shared file,
build-tools/build-infra/declare-repositories.gradle,as the single source of repository declarations, and applies it into every
consumption scope via
apply from: ..., to: <handler>:settings.gradle->pluginManagement(plugin resolution)gradle/globals.gradle->allprojects(project dependencies)solr/ui/build.gradle.kts(keeps its module-specificgoogle(), routes the rest)buildscript {}blocks ingit-status,rat-sources,jar-checks,randomization,markdown, andsolr/docker(buildscript classpath)build-tools/build-infraandbuild-tools/missing-doclet(included builds)Placing the file under
build-tools/build-infra/lets the classloader-isolatedincluded builds reach it by relative path. This follows the same pattern Lucene
uses upstream.
Enterprise mirror
Set one of the following and the entire build (including the included builds, which
inherit JVM system properties / environment) resolves exclusively from the mirror,
excluding public repositories:
-Dsolr.maven.repo.url=https://.../maven(orsystemProp.solr.maven.repo.url=...in
gradle.properties)SOLR_MAVEN_REPO_URL=https://.../mavenenvironment variableWith neither set, behavior is unchanged (
mavenCentral()+gradlePluginPortal()).Notes
LucenePrereleaserepository template ingradle/globals.gradle(still in git history); it didn't belong in a file sharedwith
pluginManagement.gradle/maven/*.gradleand thedev-only
mavenLocal()ingradle/lucene-dev/*(not consumption repos).Verification
gradlew help(all scopes),:build-infra:help, and:solr:ui:help(
-PdisableUiModule=false) all configure cleanly.scopes to it exclusively (plugin resolution fails against the bogus URL only),
confirming the override works and public repos are dropped.
configurations; no lockfiles changed (mavenCentral remains first, so resolution is
unchanged when no mirror is set).
🤖 Generated with Claude Code