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