Missing PluginMarkerMaven publication after applying another plugin

I’m trying to develop an external Groovy script plugin on 7.1.1, as follows:

// build.gradle

plugins {
  id("groovy-gradle-plugin")
  id("maven-publish")
  //id("path.to.internalplugin")
}

// for debugging

afterEvaluate {
  project.publishing.publications.each {
    println "[${project.name}.afterEvaluate] publication: " + it.name
  }
}

gradle.projectsEvaluated {
  println "[gradle.projectsEvaluated] gradlePlugin.automatedPublishing: " + gradlePlugin.automatedPublishing
  gradlePlugin.plugins.each {
    println "[gradle.projectsEvaluated] gradlePlugin: " + it.name
  }
}

My actual plugin is at:

// src/main/groovy/path.to.myplugin.gradle
// ... content not relevant

When I build this, I get:

[my-gradle-plugin.afterEvaluate] publication: path.to.mypluginPluginMarkerMaven
[my-gradle-plugin.afterEvaluate] publication: pluginMaven
All projects evaluated.
[gradle.projectsEvaluated] gradlePlugin.automatedPublishing: true
[gradle.projectsEvaluated] gradlePlugin: path.to.myplugin

So far so good.

Now, I also need to apply another internal plugin shown commented out at the top, which is imported in settings.gradle as a buildscript dependency, and which configures publications for an internal Artifactory instance. When I put that in, I get:

[my-gradle-plugin.afterEvaluate] publication: maven_my-gradle-plugin
[my-gradle-plugin.afterEvaluate] publication: pluginMaven
All projects evaluated.
[gradle.projectsEvaluated] gradlePlugin.automatedPublishing: true
[gradle.projectsEvaluated] gradlePlugin: path.to.myplugin

Here, the maven_ publication is added by this other internalplugin, but what I don’t understand is why the PluginMarkerMaven publication is now missing ?!

I looked up the Gradle plugin-development source code, and I don’t understand what can this internalplugin possibly do to cause the following line (that creates the PluginMarkerMaven publication) to NOT be executed:

Any ideas?

1 Like