UploadArchives for product flavors

UploadArchives for product flavors does not generate any artifacts(.aar files and pom files). My flavors code and uploadArchives code is mentioned below:

flavorDimensions “1.0.0”
productFlavors {
flavor1 {
dimension “1.0.0”
versionNameSuffix “-flavor1”
}
flavor2 {
dimension “1.0.0”
versionNameSuffix “-flavor2”
}
}

uploadArchives {
repositories {
mavenDeployer {
repository(url: “file://$buildDir/output/”)
pom {
groupId = ‘com.example.lib’
artifactId = ‘android-lib’
version = ‘1.0.0’
}
}
}
}

I have even tried with adding filters and parameters for pom like this:

uploadArchives {
repositories {
mavenDeployer {
repository(url: “file://$buildDir/output/”)

        addFilter('flavor1Release') {artifact, file ->
            (artifact.name == "flavor1Release")
        }

        addFilter('flavor2Release') {artifact, file ->
            (artifact.name == "flavor2Release")
        }

        pom('flavor1Release').groupId = "com.example.lib"
        pom('flavor1Release').artifactId = "flavor1Release"
        pom('flavor1Release').version = "1.0.0"

        pom('flavor2Release').groupId = "com.example.lib"
        pom('flavor2Release').artifactId = "flavor2Release"
        pom('flavor2Release').version = "1.0.0"

    }
}

}

I have seen in some posts that .aar is successfully generated but different pom files aren’t generated. But for me even .aar files aren’t getting generated on running uploadArchives. Kindly help !