With 0.7.0, I tried using the publishing plugin like this:
Copy code
val publishing: NamedDomainObjectContainer<Publication> by extensions
publishing {
"Module"(MavenPublication::class) {
// more code here
}
}
but I get this error:
Element 'publishing' of type 'org.gradle.api.publish.internal.DefaultPublishingExtension_Decorated' from container 'org.gradle.api.internal.plugins.DefaultConvention@260e45a' cannot be cast to 'org.gradle.api.NamedDomainObjectContainer'
Am I doing something wrong, or is this not supported yet?
ikej
02/16/2017, 10:41 AM
OK, I found out that this is the way to do it:
Copy code
val publishing : NamedDomainObjectContainer<Publication> = the<PublishingExtension>().publications
b
bamboo
02/16/2017, 11:47 AM
The extension is of type
PublishingExtension
so the following should give you access to it:
Copy code
val publishing: PublishingExtension by extensions
i
ikej
02/16/2017, 3:20 PM
But cannot apply a closure to
publishing
so I have to write two lines
Copy code
`
val publishing: PublishingExtension by extensions
val publications: NamedDomainObjectContainer<Publication> = publishing.publications