ScalaPB
1,341
Stars
293
Forks
39
Watchers
36
Open Issues
Apache-2.0
许可证
Scala
语言
2014-10-02
创建时间
2026-11-11
最近更新
项目能做什么
ScalaPB 是专为 Scala 设计的 Protocol Buffers 编译器插件。它解决 Scala 原生开发中 Protobuf 代码生成的痛点,能将 proto 文件转换为 Scala 样例类、解析器和序列化器。支持 proto2/proto3、gRPC、JSON 转换及与 Java 代码共存互转,便于项目渐进式迁移。
来源:AI 基于仓库事实生成
· 内容以仓库实际 README 为准
使用说明 查看原始 README 原仓库文档
中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
# ScalaPB
[](https://index.scala-lang.org/scalapb/scalapb/scalapb-runtime)
[](https://gitter.im/ScalaPB/community)
[](https://github.com/scalapb/ScalaPB/actions?query=workflow%3ACI)
ScalaPB is a protocol buffer compiler (`protoc`) plugin for Scala. It will
generate Scala case classes, parsers and serializers for your protocol
buffers.
ScalaPB generates case classes that can co-exist in the same project alongside
the Java-generated code for ProtocolBuffer. This makes it easy to gradually
migrate an existing project from the Java version of protocol buffers to
Scala. This is achieved by having the ScalaPB generated code use the proto
file as part of the package name (in contrast to Java which uses the file name
in CamelCase as an outer class)
Each top-level message and enum is written to a separate Scala file. This
results in a significant improvement in incremental compilations.
Another cool feature of ScalaPB is that it can optionally generate methods
that convert a Java protocol buffer to a Scala protocol buffer and vice versa.
This is useful if you are gradually migrating a large code base from Java
protocol buffers to Scala. The optional Java conversion is required if you
want to use `fromAscii` (parsing ASCII representation of a protocol buffer).
The current implementation delegates to the Java version.
# Highlights
- Supports proto2 and proto3
- Easily update nested structure in functional way using lenses
- Scala.js integration
- GRPC integration
- Compatible with SparkSQL (through a helper library)
- Conversion to and from JSON
- Support user-defined options (since 0.5.29)
- Support extensions (since 0.6.0)
# Versions
| Version | Description |
| ------- | ---------------------------------------------- |
| 0.6.x | Stable. Supports Protobuf 2.6.x to 3.5.x |
| 0.5.x | Supports Protobuf 2.6.x and Protobuf 3.1.x. |
| 0.4.x | Stable, unsupported. Works with Protobuf 2.6.x |
# Installing
To automatically generate Scala case classes for your messages add ScalaPB's
sbt plugin to your project. Create a file named `project/protoc.sbt`
containing the following line:
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.3"
Add the following line to your `build.sbt`:
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)
For additional configuration options, see [ScalaPB SBT Settings](https://scalapb.github.io/docs/sbt-settings) documentation
# Using ScalaPB
Documentation is available at [ScalaPB website](https://scalapb.github.io/).
# Qu
阅读完整原文
项目深度分析 AI 生成
企业级 Protobuf/gRPC Scala 性能调优与架构迁移咨询
| 产品构想 | 为重度使用Scala/Spark并依赖Protobuf/gRPC的大型企业提供跨语言Schema治理、Java-to-Scala平滑迁移方案以及代码生成性能诊断。 |
| 核心功能 | 定制化代码生成优化、SparkSQL-Protobuf序列化调优、Java与ScalaPB双向转换性能审计、专用编译器插件开发 |
| 目标用户 | 大数据处理企业、高频交易金融机构、从Java向Scala迁移的微服务团队 |
| 难度/周期 | 中等 · 2-4 周(按项目交付) · 成本:极低(主要为专家时间投入) |
| 收费模式 | 按人天或项目咨询费收取(5,000 - 20,000 USD/项目) |
| 竞争风险 | 客户群受限于Scala小众生态,销售周期长且获客成本高。 |
| 依据 | 已验证事实 |
ScalaPB 生态企业支持与 LTS 保障订阅
| 产品构想 | 面向在关键生产环境中重度依赖ScalaPB的企业,提供响应式SLA技术支持、新Scala版本优先适配(如Scala 3新特性)和安全补丁。 |
| 核心功能 | SLA保障的技术支持工单响应、向后兼容性验证保证、定制功能优先开发通道、私有依赖镜像加速 |
| 目标用户 | 金融科技、电信或大型科技公司中的平台工程团队 |
| 难度/周期 | 低 · 持续运营(按年订阅) · 成本:低(维护基础设施及客户沟通成本) |
| 收费模式 | 年费支持订阅(3,000 - 15,000 USD/年/企业) |
| 竞争风险 | 开源基础库用户普遍习惯白嫖,除非涉及合规或核心故障否则企业付费意愿偏低。 |
| 依据 | AI推测 |
基于 Schema 的跨端代码生成与 API 治理云服务 (SaaS)
| 产品构想 | 构建以ScalaPB为核心引擎之一的Protobuf Schema Registry与CI/CD自动化分发平台,一键生成并发布多版本Scala/Scala.js及Java客户端包。 |
| 核心功能 | Proto定义变更兼容性检测(Breaking change check)、在线跨版本代码生成试用、自动化Maven/Nexus私有库发布集成、文档生成器 |
| 目标用户 | 多团队协作的微服务中台开发组、全栈Scala/Scala.js开发团队 |
| 难度/周期 | 高 · 3-6 个月 · 成本:中等(云服务器、存储与CI算力开销) |
| 收费模式 | 免费额度 + 席位/构建并发阶梯月费($49 - $299/月) |
| 竞争风险 | 市场上已有Buf (buf.build) 等通用强大竞争对手,专注于Scala差异化竞争壁垒较薄弱。 |
| 依据 | 尚需验证的假设 |
AI 基于仓库公开数据分析生成,含推测成分,不构成收益承诺。
报告会保存到 个人中心
竞品与相似项目 GitHub Search 真实检索
相似项目数据正在完善中,暂不展示(避免误导)
项目优势与风险
| 技术成熟度 | 创建于 2014-10-02,近 30 天仍在推送,发布过 100 个 Release |
| 社区活跃 | Star 1,341 / Fork 293 / Issue 36(数据支持,可自行核实) |
| 许可证 | Apache-2.0 |
| 主要风险 | 上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价 |
安装与使用
此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。