The Protocol Buffers build is managed using Maven

通过maven编译protocol buffers ,

首先要我们要下载protobuf的源码到本地,下载地址:
http://code.google.com/p/protobuf/downloads/detail?name=protobuf-2.5.0.zip

解压后进入x:\protobuf-2.5.0\java,

我们会看到文件:pom.xml以及README.txt,其中README.txt介绍如何使用maven来编译protobuf源码的过程,原文如下:

1) Install Apache Maven if you don't have it:

     http://maven.apache.org/

2) Build the C++ code, or obtain a binary distribution of protoc.  If
   you install a binary distribution, make sure that it is the same
   version as this package.  If in doubt, run:

     $ protoc --version

   You will need to place the protoc executable in ../src.  (If you
   built it yourself, it should already be there.)

3) Run the tests:

     $ mvn test

   If some tests fail, this library may not work correctly on your
   system.  Continue at your own risk.

4) Install the library into your Maven repository:

     $ mvn install

5) If you do not use Maven to manage your own build, you can build a
   .jar file to use:

     $ mvn package

   The .jar will be placed in the "target" directory.

Installation - 'Lite' Version - With Maven

如果你尚未安装maven环境,你可以到上文中描述的地址先下载maven,下载地址:

http://maven.apache.org/


为满足当前的编译需要,你仅需要配置一个MAVEN_HOME,并指定一个maven.bin的的目录即可,如:

在windows系统环境变量内增加:

1、MAVEN_HOME=x:/apache-maven-3.0.5

2、path=%MAVEN_HOME%/bin;


接下来就可以按照README.txt描述的步骤逐一执行即可得到protobuf-java-2.5.0.jar,该文件会保存在当前目录下的target目录内。




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值