Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No longer able to use bundleReleaseAar in MavenPublication

After upgrading Gradle to 5.1.1, I found that I'm unable to add bundleReleaseAar as an artifact to my MavenPublication. Here's the relevant snippet of my build.gradle:

apply plugin: 'maven-publish'

publishing {
    publications {
        aar(MavenPublication) {
            groupId libraryGroupId
            version libraryVersion
            artifactId libraryArtifactId

            artifact bundleReleaseAar
            //artifact sourcesJar
            //artifact packageJavadoc
        }
    }
}

This fails with:

Could not get unknown property 'bundleReleaseAar' for object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication.

However, I am able to see that bundleReleaseAar does indeed exist when I run ./gradlew tasks, and I can execute that task just fine.

What is preventing it from being used as an artifact in my deployment now?

like image 395
Chris Watts Avatar asked Apr 26 '19 08:04

Chris Watts


People also ask

What is publish gradle?

Gradle automatically generates publishing tasks for all possible combinations of publication and repository, allowing you to publish any artifact to any repository.


1 Answers

I fix this problem change artifact from:

artifact bundleReleaseAar

to:

artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

this help me Gradle sync success, but i must call assembleRelease directly, before ./gradlew publish

like image 100
Javan You Avatar answered Sep 30 '22 19:09

Javan You