How to add gradle configuration as pom dependency using maven-publish plugin?

When the gradle plugin 'maven-publish' generates pom.xml, how can I instruct it to add configuration to the dependencies listed in this pom?

In the current "maven" plugin, the following line will be used to tell it to enable the "myCustom" configuration as a compilation dependency:

conf2ScopeMappings.addMapping(1, configurations.myCustom, "compile")

I'm really looking to get the same functionality with the new maven-publish plugin

build.gradle:

apply plugin: 'maven-publish'

configurations {
    myCustom
}

dependencies {
    myCustom 'my:custom-dep:1.0'
}

publishing {
  publications {
    myPublication(MavenPublication) {

    }
 }
}

run gradle generatePomFileForMyPublicationPublication

current result:

<project xsi: ... >
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.group</groupId>
  <artifactId>id</artifactId>
  <version>0.0.1</version>
  <packaging>pkg</packaging>
                             <-- need custom-dep dependency here
</project>
+3
source share

All Articles