I finally found a solution!
I was doing a few things wrong, first, both dokkaJar and sourceJar tasks have to be in the main build.gradle
and not inside deploy-bintray.gradle.kts
. Moving them made it work and fixes:
SourceSet with name 'main' not found.
Secondly we cannot use from(components["java"])
because this is an Android lib so I’ve replaced that line with artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
.
Last but not least, as stated here (step 7):
“Also, the POM file generated does not include the dependency chain so
it must be explicitly added…”
I had to add this:
pom {
...
withXml {
val dependenciesNode = asNode().appendNode("dependencies")
configurations.getByName("implementation") {
dependencies.forEach {
val dependencyNode = dependenciesNode.appendNode("dependency")
dependencyNode.appendNode("groupId", it.group)
dependencyNode.appendNode("artifactId", it.name)
dependencyNode.appendNode("version", it.version)
}
}
}
}