pluginPublish task not respecting nebula.maven-publish rules to publish a resolved pom

We’re seeing our resolved dependencies plugin not work when publishing to the plugin portal.

Here’s what is published to the plugin portal for 3.6.3 of nebula.netflixoss

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.netflix.nebula</groupId>
  <artifactId>gradle-netflixoss-project-plugin</artifactId>
  <version>3.6.3</version>
  <dependencies>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>gradle-contacts-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>gradle-dependency-lock-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>gradle-info-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-bintray-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-core</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-project-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-publishing-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-release-plugin</artifactId>
      <version>latest.release</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
    <dependency>
      <groupId>gradle.plugin.nl.javadude.gradle.plugins</groupId>
      <artifactId>license-gradle-plugin</artifactId>
      <version>0.13.1</version>
      <scope>compile</scope>
      <type>jar</type>
      <optional>false</optional>
    </dependency>
  </dependencies>
</project>

and here is what we published to bintray

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.netflix.nebula</groupId>
  <artifactId>gradle-netflixoss-project-plugin</artifactId>
  <version>3.6.3</version>
  <dependencies>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>gradle-contacts-plugin</artifactId>
      <version>3.0.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>gradle-dependency-lock-plugin</artifactId>
      <version>4.9.4</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>gradle-info-plugin</artifactId>
      <version>3.5.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-bintray-plugin</artifactId>
      <version>3.5.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-core</artifactId>
      <version>4.0.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-project-plugin</artifactId>
      <version>3.3.0</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-publishing-plugin</artifactId>
      <version>4.9.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>com.netflix.nebula</groupId>
      <artifactId>nebula-release-plugin</artifactId>
      <version>4.1.1</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>gradle.plugin.nl.javadude.gradle.plugins</groupId>
      <artifactId>license-gradle-plugin</artifactId>
      <version>0.13.1</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
  <name>gradle-netflixoss-project-plugin</name>
  <description>Template for NetflixOSS projects</description>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <developers>
    <developer>
      <id>rspieldenner</id>
      <name>Rob Spieldenner</name>
      <email>rob.spieldenner@gmail.com</email>
    </developer>
    <developer>
      <id>quidryan</id>
      <name>Justin Ryan</name>
      <email>justin@halfempty.org</email>
    </developer>
  </developers>
  <properties>
    <nebula_Manifest_Version>1.0</nebula_Manifest_Version>
    <nebula_Implementation_Title>com.netflix.nebula#gradle-netflixoss-project-plugin;3.6.3</nebula_Implementation_Title>
    <nebula_Implementation_Version>3.6.3</nebula_Implementation_Version>
    <nebula_Built_Status>integration</nebula_Built_Status>
    <nebula_Built_By>rspieldenner</nebula_Built_By>
    <nebula_Built_OS>Mac OS X</nebula_Built_OS>
    <nebula_Build_Date>2017-05-31_13:53:36</nebula_Build_Date>
    <nebula_Gradle_Version>4.0-rc-1</nebula_Gradle_Version>
    <nebula_Module_Owner>rob.spieldenner@gmail.com,justin@halfempty.org</nebula_Module_Owner>
    <nebula_Module_Email>rob.spieldenner@gmail.com,justin@halfempty.org</nebula_Module_Email>
    <nebula_Module_Source></nebula_Module_Source>
    <nebula_Module_Origin>git@github.com:rspieldenner/gradle-netflixoss-project-plugin.git</nebula_Module_Origin>
    <nebula_Change>1dc226a</nebula_Change>
    <nebula_Branch>master</nebula_Branch>
    <nebula_Build_Host>nfml-rspieldenner93G</nebula_Build_Host>
    <nebula_Build_Job>LOCAL</nebula_Build_Job>
    <nebula_Build_Number>LOCAL</nebula_Build_Number>
    <nebula_Build_Id>LOCAL</nebula_Build_Id>
    <nebula_Created_By>1.7.0_79-b15 (Oracle Corporation)</nebula_Created_By>
    <nebula_Build_Java_Version>1.7.0_79</nebula_Build_Java_Version>
    <nebula_X_Compile_Target_JDK>1.7</nebula_X_Compile_Target_JDK>
    <nebula_X_Compile_Source_JDK>1.7</nebula_X_Compile_Source_JDK>
  </properties>
  <url>https://github.com/rspieldenner/gradle-netflixoss-project-plugin</url>
  <scm>
    <url>git@github.com:rspieldenner/gradle-netflixoss-project-plugin.git</url>
  </scm>
</project>

How should we get https://github.com/nebula-plugins/nebula-publishing-plugin to begin working again with the plugin publishing specifically the MavenResolvedDependenciesPlugin

The plugin-publish plugin currently uses its own POM generation mechanism. We should instead let it work with the publishing API, so that plugins like yours can adjust the publications.

Hi Rob!

There is potential workaround in the meantime: there’s an (undocumented) hook inside the pluginBundle DSL that allows you to alter the set of dependencies:

pluginBundle {
   // ...

  withDependencies { deps ->
    println deps

    // remove a dep
    deps.remove(0)

    // add a new one
    deps.add(new org.apache.maven.model.Dependency(groupId: 'com.foo', artifactId: 'the artifact', version: '1.2')

    // alter them
    deps.each { dep ->
      if (dep.version == 'latest.release') {
        dep.version = // resolve the real version here
      }
    }
  }
}

What is passed in is a List<org.apache.maven.model.Dependency>. Any changes made to that list will be reflected in the generated POM.

Hope that helps!

Cheers

Tom

Are the dependencies in the deps list from compileClasspath, runtimeClasspath or some other configuration?