def _rename_artifact(ctx, tpl_string, src_file, packaging_type):
    """Rename the artifact to match maven naming conventions."""
    artifact = ctx.new_file(ctx.bin_dir, tpl_string % (ctx.attr.artifact_id, ctx.attr.version, packaging_type))
    ctx.action(
        inputs = [src_file],
        outputs = [artifact],
        command = "cp %s %s" % (src_file.path, artifact.path),
    )
    return artifact