temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 1 | Protocol Buffers - Google's data interchange format |
| 2 | Copyright 2008 Google Inc. |
| 3 | |
| 4 | This directory contains the Java Protocol Buffers runtime library. |
| 5 | |
temporal | cc93043 | 2008-07-21 20:28:30 +0000 | [diff] [blame] | 6 | Installation - With Maven |
| 7 | ========================= |
| 8 | |
| 9 | The Protocol Buffers build is managed using Maven. If you would |
gk5885 | 5ea590d | 2009-08-04 23:43:27 +0000 | [diff] [blame^] | 10 | rather build without Maven, see below. |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 11 | |
| 12 | 1) Install Apache Maven if you don't have it: |
| 13 | |
| 14 | http://maven.apache.org/ |
| 15 | |
| 16 | 2) Build the C++ code, or obtain a binary distribution of protoc. If |
| 17 | you install a binary distribution, make sure that it is the same |
| 18 | version as this package. If in doubt, run: |
| 19 | |
| 20 | $ protoc --version |
| 21 | |
| 22 | You will need to place the protoc executable in ../src. (If you |
| 23 | built it yourself, it should already be there.) |
| 24 | |
| 25 | 3) Run the tests: |
| 26 | |
| 27 | $ mvn test |
| 28 | |
| 29 | If some tests fail, this library may not work correctly on your |
| 30 | system. Continue at your own risk. |
| 31 | |
| 32 | 4) Install the library into your Maven repository: |
| 33 | |
| 34 | $ mvn install |
| 35 | |
| 36 | 5) If you do not use Maven to manage your own build, you can build a |
| 37 | .jar file to use: |
| 38 | |
| 39 | $ mvn package |
| 40 | |
| 41 | The .jar will be placed in the "target" directory. |
gk5885 | 5ea590d | 2009-08-04 23:43:27 +0000 | [diff] [blame^] | 42 | |
| 43 | Installation - 'Lite' Version - With Maven |
| 44 | ========================= |
| 45 | |
| 46 | Building the 'lite' version of the Java Protocol Buffers library is |
| 47 | the same as building the full version, except that all commands are |
| 48 | run using the 'lite' profile. (see |
| 49 | http://maven.apache.org/guides/introduction/introduction-to-profiles.html) |
| 50 | |
| 51 | E.g. to install the lite version of the jar, you would run: |
| 52 | |
| 53 | $ mvn install -P lite |
| 54 | |
| 55 | The resulting artifact has the 'lite' classifier. To reference it |
| 56 | for dependency resolution, you would specify it as: |
| 57 | |
| 58 | <dependency> |
| 59 | <groupId>com.google.protobuf</groupId> |
| 60 | <artifactId>protobuf-java</artifactId> |
| 61 | <version>${version}</version> |
| 62 | <classifier>lite</classifier> |
| 63 | </dependency> |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 64 | |
temporal | cc93043 | 2008-07-21 20:28:30 +0000 | [diff] [blame] | 65 | Installation - Without Maven |
| 66 | ============================ |
| 67 | |
| 68 | If you would rather not install Maven to build the library, you may |
| 69 | follow these instructions instead. Note that these instructions skip |
| 70 | running unit tests. |
| 71 | |
| 72 | 1) Build the C++ code, or obtain a binary distribution of protoc. If |
| 73 | you install a binary distribution, make sure that it is the same |
| 74 | version as this package. If in doubt, run: |
| 75 | |
| 76 | $ protoc --version |
| 77 | |
| 78 | If you built the C++ code without installing, the compiler binary |
| 79 | should be located in ../src. |
| 80 | |
| 81 | 2) Invoke protoc to build DescriptorProtos.java: |
| 82 | |
| 83 | $ protoc --java_out=src/main/java -I../src \ |
| 84 | ../src/google/protobuf/descriptor.proto |
| 85 | |
| 86 | 3) Compile the code in src/main/java using whatever means you prefer. |
| 87 | |
| 88 | 4) Install the classes wherever you prefer. |
| 89 | |
temporal | 40ee551 | 2008-07-10 02:12:20 +0000 | [diff] [blame] | 90 | Usage |
| 91 | ===== |
| 92 | |
| 93 | The complete documentation for Protocol Buffers is available via the |
| 94 | web at: |
| 95 | |
| 96 | http://code.google.com/apis/protocolbuffers/ |