def main()

in rules_jvm_export/jvm_export/support/deploy.py [0:0]


def main():
    args = _parse_args()
    repo_type = "local" if args.local else args.command
    maven_url = _to_url(args.publish_to) if args.publish_to else MAVEN_REPOS[repo_type]
    pom = ElementTree.parse(POM_FILE_PATH).getroot()
    group_id = _parse_pom(pom, "ns0:groupId")
    artifact_id = _parse_pom(pom, "ns0:artifactId")
    version = _parse_pom(pom, "ns0:version")
    version_snapshot_regex = """^[0-9|a-f|A-F]{40}$|.*-SNAPSHOT$"""
    version_release_regex = """^[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]+)*$"""
    if (
        repo_type == "snapshot"
        and len(re.findall(version_snapshot_regex, version)) == 0
    ):
        raise ValueError(
            "Invalid version: {}. An artifact uploaded to a {} repository "
            "must have a version which complies to this regex: {}".format(
                version, repo_type, version_snapshot_regex
            )
        )
    if repo_type == "release" and len(re.findall(version_release_regex, version)) == 0:
        raise ValueError(
            "Invalid version: {}. An artifact uploaded to a {} repository "
            "must have a version which complies to this regex: {}".format(
                version, repo_type, version_release_regex
            )
        )
    curl_opts = _curl_options(maven_url, args.netrc)

    filename_base = "{coordinates}/{artifact}/{version}/{artifact}-{version}".format(
        coordinates=group_id.replace(".", "/"), version=version, artifact=artifact_id
    )

    for classifier, artifact_path in ARTIFACTS.items():
        remote_path = f"{filename_base}-{classifier}.jar" if classifier else f"{filename_base}.jar"
        upload_with_sig(maven_url, curl_opts, args.gpg, artifact_path, remote_path)        

    upload_with_sig(maven_url, curl_opts, args.gpg, POM_FILE_PATH, filename_base + ".pom")