gpt4 book ai didi

java - 如何生成protobuf 3.0 jar java?

转载 作者:行者123 更新时间:2023-11-30 02:50:19 25 4
gpt4 key购买 nike

我对 protobuf 2.5 很熟悉。我试图使用protobuf3.0。看来该 jar 是从网上提供的源代码生成的。但是当我将源代码导入 eclipse 并尝试创建 jar 时,我可以在以下文件中看到许多错误

/protobuf3/src/com/google/protobuf/Descriptors.java,
/protobuf3/src/com/google/protobuf/DynamicMessage.java
/protobuf3/src/com/google/protobuf/ExtensionRegistry.java
/protobuf3/src/com/google/protobuf/MessageReflection.java
/protobuf3/src/com/google/protobuf/TextFormat.java
/protobuf3/src/com/google/protobuf/UnsafeUtil.java

这是“无法解析导入 com.google.protobuf.DescriptorProtos”的错误之一。

这是生成 jar 的正确方法吗(或者)它是否可以在任何地方使用(或者)是否可以在任何地方使用完整的源代码。

如有任何帮助,我们将不胜感激。谢谢。

这是我下载源代码的地方protobuf3.0-source code

最佳答案

您可以在此处找到要下载的 Protobuf 的编译(JAR)版本:

http://search.maven.org/remotecontent?filepath=com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar

我建议您查看构建管理器,例如 https://maven.apache.org/自动为您处理获取依赖项(库)。

关于java - 如何生成protobuf 3.0 jar java?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38890074/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com