{"id":13450886,"url":"https://github.com/bazelbuild/migration-tooling","last_synced_at":"2025-03-23T16:32:44.920Z","repository":{"id":54601908,"uuid":"93647440","full_name":"bazelbuild/migration-tooling","owner":"bazelbuild","description":"Migration tools for Bazel","archived":true,"fork":false,"pushed_at":"2019-01-30T13:22:25.000Z","size":11365,"stargazers_count":44,"open_issues_count":43,"forks_count":30,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-06-07T07:32:33.972Z","etag":null,"topics":["bazel","java"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazelbuild.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-07T14:55:34.000Z","updated_at":"2024-04-24T00:45:54.000Z","dependencies_parsed_at":"2022-08-13T21:00:54.336Z","dependency_job_id":null,"html_url":"https://github.com/bazelbuild/migration-tooling","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fmigration-tooling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fmigration-tooling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fmigration-tooling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazelbuild%2Fmigration-tooling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazelbuild","download_url":"https://codeload.github.com/bazelbuild/migration-tooling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":213324789,"owners_count":15570181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","java"],"created_at":"2024-07-31T07:00:39.832Z","updated_at":"2024-07-31T07:01:56.185Z","avatar_url":"https://github.com/bazelbuild.png","language":"Java","readme":"# DEPRECATED\n\nThis project is deprecated. Use [build-deps](https://github.com/johnynek/bazel-deps) instead.\n\n[![Build status](https://badge.buildkite.com/3d265f4a4ef0aa6c54208278c5062491bb074298069d30b051.svg)](https://buildkite.com/bazel/migration-tooling-postsubmit)\n\n# Migration tooling\n\nThis repository contains tools used for migrating existing projects to Bazel.\n\n## Maven-to-Bazel\n\nTo migrate a Maven project to Bazel, build:\n\n```\nbazel run //generate_workspace -- --maven_project=/path/to/maven/project\n```\n\nThis will create a file `generate_workspace.bzl`. Copy it to your workspace\nand add the following to your WORKSPACE file:\n\n``` python\nload(\"//:generate_workspace.bzl\", \"generated_maven_jars\")\ngenerated_maven_jars()\n```\n\nThen you can access any of the jars in `generate_workspace.bzl`.\n\nOptionally, add the following to a BUILD file:\n\n``` python\nload(\"//:generate_workspace.bzl\", \"generated_java_libraries\")\ngenerated_java_libraries()\n```\n\nThen you can access any of the Java library targets in `generate_workspace.bzl`,\nwhich export each jar's dependencies as well as the jar itself.\n\n## `transitive_maven_jar` \n\nThe `transitive_maven_jar` repository rule exposes the specified Maven jars, as well as their transitive dependencies under one target. This alleviates the need to run\n`generate_workspace` whenever dependencies change. However, it comes at the cost of re-fetching dependencies.\n\nAs a prerequisite for use, you must have bazel 0.5.2 or later installed. In addition, add the following to your `WORKSPACE` file: \n\n```python\nhttp_archive(\n\tname = \"trans_maven_jar\",\n\turl = \"https://github.com/bazelbuild/migration-tooling/archive/master.zip\",\n\ttype = \"zip\",\n\tstrip_prefix = \"migration-tooling-master\",\n)\n\nload(\"@trans_maven_jar//transitive_maven_jar:transitive_maven_jar.bzl\", \"transitive_maven_jar\")\n\n```\n\nNow, within your `WORKSPACE` file, you can define your external maven dependencies as follows\n\n```python\ntransitive_maven_jar(\n\tname = \"dependencies\",\n\tartifacts = [\n\t\t\"something:something:4.0\",\n\t\t\"otherthing:otherthing:3.2\",\n\t\t...\n\t]\n)\n\nload(\"@dependencies//:generate_workspace.bzl\", \"generated_maven_jars\")\ngenerated_maven_jars()\n```\nThe `transitive_maven_jar` rule will resolve the transitive dependencies for the specified artifacts and then it will generate a `generate_workspace.bzl` which you must load in your `WORKSPACE` file.\n\n## Code\nThis code was inspired by the [aether examples](https://github.com/eclipse/aether-demo/blob/322fa556494335faaf3ad3b7dbe8f89aaaf6222d/aether-demo-snippets/src/main/java/org/eclipse/aether/examples/GetDependencyTree.java) for walking maven dependencies.\n","funding_links":[],"categories":["迁移工具","Tooling"],"sub_categories":["Code ownership","Migration"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Fmigration-tooling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazelbuild%2Fmigration-tooling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazelbuild%2Fmigration-tooling/lists"}