Skip to content

feature-request: add android_library support to maven distribution #233

@jagobagascon

Description

@jagobagascon

I'm trying to deploy an android_library to maven, but maven assemble and deployment rules only work with jars, and I need to upload an aar artifact.

I tried modifying the rules myself to make a PR but for some reason aspects are not working when I define the aar as target (and thus pom generation fails). I think it may be a bug with Bazel or the Android rules but I couldn't make it work without having to completely change the deployment rule.

The aar artifact is an implicit output of the android_library rule, which means it's just a file and aspects do not work on them.

assemble_maven(
    name = 'assemble',
    target = ':my_android_lib',
)
assemble_maven(
    name = 'assemble',
    target = ':my_android_lib.aar', # fails because aspects are not executed
)

To make it work I had to modify the deployment so I could generate the pom and then explicitly choose the deployed file:

assemble_maven(
    name = 'generate_pom',
    target = ':build',
)
publish_maven(
    name = 'publish',
    pom_file = ':generate_pom',
    target = ':build.aar',
    sources = ':build.srcjar',
)

Are there any plans on supporting Android aar files?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions