Use a custom plugin stored in Nexus

Hi, apologies if this is a silly question but I seem unable to find a clear answer.

I have written a custom plugin which has been successfully uploaded as a release into my local nexus repo.
From a maven perspective it all seems to be fine. The pom looks like this

project xsi:schemaLocation=""><modelVersion>4.0.0</modelVersion><groupId>com.spidasolutions.gradle</groupId><artifactId>SpidaGradleBasePlugin</artifactId><version>0.1.0</version><dependencies><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency></dependencies></project>

in my settings.gradle I have specified the repo set
pluginRepositories {
maven {
url ‘https://mynexus/nexus/repository/maven-releases

in my build.gradle I am referencing the plugin
plugins {
id “com.spidasolutions.gradle.SpidaGradleBasePlugin” version “0.1.0”

the build however fails saying the plugin doesnt exist. I assume I need to customise the way the artefact goes into nexus but I cant seem to find anything to help me with this

* What went wrong:
09:05:17.220 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Plugin [id: 'com.spidasolutions.gradle.SpidaGradleBase', version: '0.1.0'] was not found in any of the following sources:
09:05:17.220 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
09:05:17.220 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
09:05:17.220 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - maven(https://mynexus/nexus/repository/maven-releases) (Could not resolve plugin artifact 'com.spidasolutions.gradle.SpidaGradleBase:com.spidasolutions.gradle.SpidaGradleBase.gradle.plugin:0.1.0')

any assistance would be much appreciated.

In order to use the new plugins DSL, it is necessary to publish both the plugin implementation artifact and a marker artifact. The marker artifact is used to resolve the implementation artifact from the id that you provide in the plugins {...} block. The exception suggests that you did not publish the marker artifact (this can be handled automatically for you).

Does your build that published the plugin look like the example plugin example in the user guide? Your usage of the plugin looks fine.

HI James, thanks for the advice. That was what was missing for sure.
I have applied changes that should I would have said have worked but I am still not resolving the plugin for some reason.

I have the gradlePlugin section now
gradlePlugin {
plugins {
spidagradlebase {
id = "com.spidasolutions.gradle.spidagradlebase"
implementationClass = “com.spidasolutions.gradle.SpidaGradleBase”
my plugin has a properties file in the META-INF/gradle-plugins folder to match the id.
I can run gralde plublish successfully and the marker is being generated. It looks like it should be fine to me, the generated POM is

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">

I am then referencing the plugin
plugins {
id ‘com.spidasolutions.gradle.spidagradlebase’ version '0.1.0’
id 'maven’
id ‘groovy’

the error appears much the same
* What went wrong:
16:33:12.023 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Plugin [id: ‘com.spidasolutions.gradle.spidagradlebase’, version: ‘0.1.0’] was not found in any of the following sources:
16:33:12.023 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
16:33:12.023 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Gradle Core Plugins (plugin is not in ‘org.gradle’ namespace)
16:33:12.023 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - maven(https://mynexus/nexus/repository/maven-releases/) (Could not resolve plugin artifact ‘com.spidasolutions.gradle.spidagradlebase:com.spidasolutions.gradle.spidagradlebase.gradle.plugin:0.1.0’)
16:33:12.023 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] - Gradle Central Plugin Repository (no ‘com.spidasolutions.gradle.spidagradlebase’ plugin available - see for available plugins)

I thought it might be usefull to know that I can resolve the marker artifact using maven

mvn org.apache.maven.plugins:maven-dependency-plugin:2.1:get \
    -DrepoUrl=https://mynexus/nexus/repository/maven-releases/ \

Not sure if this helps the discussion but looking into the --debug output I can see gradle is contructing the url for the marker pom correctly. I can take that url and use curl to get the file

07:22:17.398 [DEBUG] [org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver] Loading https://mynexus/nexus/repository/maven-releases/com/spidasolutions/gradle/spidagradlebase/com.spidasolutions.gradle.spidagradlebase.gradle.plugin/0.1.0/com.spidasolutions.gradle.spidagradlebase.gradle.plugin-0.1.0.pom
07:22:17.398 [DEBUG] [org.gradle.internal.resource.transfer.DefaultCacheAwareExternalResourceAccessor] Constructing external resource: https://mynexus/nexus/repository/maven-releases/com/spidasolutions/gradle/spidagradlebase/com.spidasolutions.gradle.spidagradlebase.gradle.plugin/0.1.0/com.spidasolutions.gradle.spidagradlebase.gradle.plugin-0.1.0.pom

is it possible this is a bug in the plugin process for gradle?


Do you have a valid certificate for your Nexus server?

I can reproduce your latest result, but only if I install a self-signed certificate for HTTPS on Nexus.

yup, I certainly do. I am able to use the old method to resolve the plugin
from nexus just fine (I thought I would give that a go yesterday).

Hi Paul,

It seems I’m having the same problem you had.
Were you ever able to use the plugins DSL successfully with your custom plugins on Nexus or are you still using the buildscript block?
It looks like the issue is that the plugins dsl ignores the transitive dependency in the marker pom.
I tested this on Gradle version 4.10.

Best wishes,

Running into the same issue with gradle 6.3

Reminds me of

I got it to work eventually, although why it did now work in the first place is still unknown.

My problem was similar to the others’ - the pom file would get downloaded from nexus and for no reason at all gradle would ignore it and go on to try to download it from the gradle plugin portal.

My settings.gradle had some fancy resolution of the maven username and password, and when I simplified that it started working. So now the settings.gradle file looks like:

pluginManagement {
    repositories {
        maven {
            name = "nexus"
            url =  ""
            credentials {
                username "${System.env.NEXUS_USER ?: repoUser }" 
                password "${System.env.NEXUS_PASSWORD  ?: repoPassword }"

As for the plugin itself - it is important to carefully follow the instructions in the link that has already been mentioned - here