Repositories.mavenDeployer don't add dependency type attribute to the result pom.xml

If you want to deploy library which has dependency on something different like .jar gradle generate invalid pom.xml for the library because it skip element in .

Example I have library project which has this dependency:

compile ''

During deploy gradle create this in the targer pom.xml


But aar is missing :frowning: So this pom.xml is invalid, because if is missing it should be jar, but jar type dependency doesn’t exist in the repo.

It is possible to fix it by this workaround

uploadArchives {
    repositories.mavenDeployer {
        pom.groupId = groupId
        pom.artifactId = artifactId
        pom.version = version
        // Add other pom properties here if you want (developer details / licenses)
        repository(url: "file://${localReleaseDest}")
        // workaround for:
        pom.whenConfigured { pom ->
            pom.dependencies.findAll { dependency ->
                if (dependency.artifactId == 'appcompat-v7') {
                    dependency.type = 'aar'

But I think that gradle should do itself.

Another topic with the same problem