Java and Google protocol buffers: how to make a jar?

I downloaded the source code (because there is no compiled version) and I compiled it, but it did not generate .jar. Instead, he made a file that can be executed in the bash / zsh shell.

./protoc <params>

I need a can, because for this I need a can: http://code.google.com/p/protoclipse/

+3
source share
3 answers

Here is the compiler. Details for creating jar files: here .

+1
source

You can download the required jar from maven here . Click on the link corresponding to the binary download

+11
source

, .

maven. : http://maven.apache.org/download.cgi

"" PATH. , JAVA_HOME JDK.

, ​​ . java, README ( , ). src, " " protoc.exe, .jar. , protoc.exe protobuf src. linux, .

protoc.exe src, mvn package " java > . target, java. .jar.


, , :

maven: C:\MyPrograms\apache-maven-3.1.0\
protoc src ( ): D:\Downloads\protobuf-2.5.0\
protoc ( protoc.exe): D:\Downloads\protoc-2.5.0-win32\
java jdk: C:\Program Files\Java\jdk1.7.0_21

SET PATH=%PATH%;C:\MyPrograms\apache-maven-3.1.0\bin
SET JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21
cd D:\Downloads\protobuf-2.5.0\
copy D:\Downloads\protoc-2.5.0-win32\protoc.exe src
cd java
mvn package

NOTE: if you are using Linux, you will need to replace the copy with protoc compilation. Also, setting the path is most likely not needed or will not be done in another way.

therefore instead of:

copy D:\Downloads\protoc-2.5.0-win32\protoc.exe src

you will have:

./configure
make
make check
make install

(just make sure the generated binary is copied to the right folder)

+2
source

Source: https://habr.com/ru/post/1785326/


All Articles