I have a project, multiple library modules, multiple build types. Followed the documentation here: LibraryPublishing | Android Developers
using Gradle 7.3.3
I made it work exactly as documentation states, only that it uploads a lot of files.
For my case, I need to copy just one .aar file to another folder locally.
artifact "build/outputs/aar/${project.name}-${version}.aar"
>> does not work anymore. I think that this command now “adds” this aar file to the existing ones (the ones that were built by ./gradlew build) to the upload process. And it throws this error:
Failed to publish publication ‘local’ to repository ‘MavenLocal’
Invalid publication ‘local’: multiple artifacts with the identical extension and classifier (‘aar’, ‘null’).
any thoughts ? this artifact command used to work in a different way in a prior gradle version (like it only uploaded that aar)
PS: a lof of files uploaded meaning this:
maven-metadata.xml
maven-metadata.xml.md5
maven-metadata.xml.sha1
maven-metadata.xml.sha256
maven-metadata.xml.sha512
rendererLib-0.0.20-local.aar. ← I only need this to be uploaded
rendererLib-0.0.20-local.aar.md5
rendererLib-0.0.20-local.aar.sha1
rendererLib-0.0.20-local.aar.sha256
rendererLib-0.0.20-local.aar.sha512
rendererLib-0.0.20-local.module
rendererLib-0.0.20-local.module.md5
rendererLib-0.0.20-local.module.sha1
rendererLib-0.0.20-local.module.sha256
rendererLib-0.0.20-local.module.sha512
rendererLib-0.0.20-local.pom
rendererLib-0.0.20-local.pom.md5
rendererLib-0.0.20-local.pom.sha1
rendererLib-0.0.20-local.pom.sha256
rendererLib-0.0.20-local.pom.sha512
publishing {
publications {
local(MavenPublication) {
groupId = 'com.abc.asd'
artifactId = project.name
version = "${android.defaultConfig.versionName}-local"
def aarName = "${artifactId}-${version}.aar"
println "!!!!!!!!!!! ${aarName}"
artifacts {
artifact "$buildDir/outputs/aar/rendererLib-0.0.20-local.aar"
}
afterEvaluate {
from components.local // I have a build type called local
}
}
}
repositories {
mavenLocal {
url("$buildDir/../../../../WORK2/JustAnotherProjectsFolder/app/libs/")
}
}
}