App module build.gradle
apply plugin: 'com.android.library'
apply from: rootProject.file('deploy-bintray.gradle.kts')
android {...}
deploy-bintray.gradle.kts it's my bintray/maven publications script.
I'm having problems generating .jar files:
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(project.the<SourceSetContainer>()["main"].allSource)
}
publications {
create<MavenPublication>(bintrayRepo) {
groupId = publishedGroupId
artifactId = artifact
version = libraryVersion
from(components["java"])
artifact(sourcesJar.get())
artifact(dokkaJar.get())
...
}
}
}
it fails with:
SoftwareComponentInternal with name 'java' not found.
or, if I comment from(components["java"])
it fails with:
SourceSet with name 'main' not found.
If I add java plugin:
The 'java' plugin has been applied, but it is not compatible with the Android plugins.
So I'm stuck here. How can I solve this?