문제

I have an Apache AVRO IDL that defines a protocol that I would like to use between a java client and a server written in Python.

@namespace("myproto.proto")

protocol myproto 
{

  enum Status
  {
    STATUS_OK,
    STATUS_ERROR
  }

  record GameList
  {
    array<string> games;
  }

  void somefunc(int arg);
}

For Python, I use this:

AVROTOOLS=$(TOOLS_PATH)/avro-tools-1.7.4.jar
java -jar $(AVROTOOLS) idl fairunfair.avdl fairunfair.avpr

How can I compile the IDL into Java? Without using maven, if possible.

도움이 되었습니까?

해결책

You can generate a JSON schema from your IDL with avro-tools:

java -jar avro-tools-1.7.4.jar idl /path/to/idl

Then just compile the schema into Java as usual:

java -jar avro-tools-1.7.4.jar compile schema /path/to/schema .

I don't think there is any way to compile directly to Java from IDL. The avro-tools help menu reveals no such option.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top