Skip to content

Commit 1f30b54

Browse files
Append Artifactory instead of resetting the chain
1 parent e365d9b commit 1f30b54

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

rewrite-gradle-tooling-model/model/src/main/java/org/openrewrite/gradle/toolingapi/OpenRewriteModelBuilder.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ private static String mirrorScriptSnippet() {
173173
"def __rewriteMirrorUrl = '" + escapeGroovy(url) + "'\n" +
174174
"def __rewriteMirrorUser = '" + escapeGroovy(user) + "'\n" +
175175
"def __rewriteMirrorPass = '" + escapeGroovy(pass) + "'\n" +
176+
// Prepend Artifactory as a Maven Central proxy without removing any repository the
177+
// build (or its plugins) declared. Gradle tries repositories in order and falls
178+
// through on 404, so Central artifacts come from Artifactory while Plugin Portal-only
179+
// markers (Nebula, Develocity, etc.) still resolve from gradlePluginPortal().
176180
"def __rewriteConfigureMirror = { container ->\n" +
181+
" def existing = new ArrayList(container as Collection)\n" +
177182
" container.clear()\n" +
178183
" container.maven {\n" +
179184
" url = __rewriteMirrorUrl\n" +
@@ -182,6 +187,7 @@ private static String mirrorScriptSnippet() {
182187
" password = __rewriteMirrorPass\n" +
183188
" }\n" +
184189
" }\n" +
190+
" existing.each { container.add(it) }\n" +
185191
"}\n" +
186192
"allprojects {\n" +
187193
" buildscript.repositories { __rewriteConfigureMirror(delegate) }\n" +

0 commit comments

Comments
 (0)