简体   繁体   中英

How do I load a avro schema in IntelliJ?

I cloned a project from github and now have it open as a project in IntelliJ. The project is written in Scala.

The project depends on some objects defined in an avro schema that is in another project on github. The avro schema is a single *.avdl file.

How do I load the avro *.advl schema / file in my project in IntelliJ?

So that the object types defined in the avro schema are known in the rest of the project.

Does IntelliJ recognize avro *.advl files? Do I need to generate Scala/Java classes somehow from the avro advl file? And then load these classes?

Have you tried the Avro support plugin? https://plugins.jetbrains.com/plugin/7971?pr=idea

What I ended up doing is:

Download avro tools: https://github.com/miguno/avro-cli-examples/blob/master/README.md

Use the following tools from the jar

idl2schemata  Extract JSON schemata of the types from an Avro IDL file
compile  Generates Java code for the given schema

The resulting set of java classes I put under the correct package in my code.

This at least made the type checker happy in IntelliJ. Did not run the code yet.

I recently started an Avro project and was annoyed at having to use avro-tools.jar, so I made an IntelliJ plugin - https://plugins.jetbrains.com/plugin/12281-avro-viewer . Drag-and-drop Avro files and they're displayed in plain text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM