Publish only one aar for maven central

I am struggling with the following scenario.

I am developing an android library with two convenient boards + for free. There are some differences in sources and resources, why I should have two AARs. My business logic only allows me to release the free version for MavenCentral. However, it uploadArchivesaccepts all artifacts created by the task assemble.

My current hack is to pass an argument -Plib_versionto gradle:

if ("paid".equals(lib_version)) {
    defaultPublishConfig "paidRelease"
} else if ("free".equals(lib_version)) {
    defaultPublishConfig "freeRelease"
} else {
    publishNonDefault true
}

So, when I wanted to release only the paid version, my gradle launch looks like

./gradlew uploadArchives -Plib_version=free

Does anyone know a better trick? A better option would be to specify MavenDeployer files for signature and download.

thanks

+4
source share

Source: https://habr.com/ru/post/1621286/


All Articles