Gradle plugin Mirror

Hello Peeps,

Kinda new to gradle, but im an experienced devops guy, and I never had trouble setting up a local maven mirror and configuring build pipelines to use it, except when I started using gradle. I can see in the documentation clearly how to consume a maven mirror in gradle, but nothing about how to consume a gradle plugin mirror (I can set up the gradle plugin mirror but having a hard time configuring gradle globally to use my sonatype nexus as a gradle plugin mirror).

Please help because I’ve wasted hours on this.

It is the same as for other repositories, nothing special.
Just that you have to declare it as plugin repository, so within the pluginManagement { repositories { ... } } block of the settings script.

and that has to be configured in every project or can it be done globally? because I tried that and it didn’t work.

You could probably have an init script that does the configuration in your Gradle User Home’s init.d directory.

Maybe you should share what you tried and what the result was.

Gladly:
Here’s my settings in my gradle user home

Here’s my sonatype repo:

And here’s the thing blowing up in my face:

You are in an init script, not in a settings script.
pluginManagement { ... } exists on a Settings object that you work with in a settings script.
In an init script you work with a Gradle object.
If you wrap that block in a beforeSettings { ... } to configure the settings script when it is evaluated, it probably will work.

1 Like

Have my babies..

It worked, thanks man!!

For reference in case anyone faces the same issue :smiley: