Protobuf Support Plugin for IntelliJ IDEA & other JetBrains products.
PLEASE SWITCH TO https://github.com/jvolkman/intellij-protobuf-editor
Latest plugin release is compatible with IntelliJ IDEA 2018.2 (older releases are compatible with IDEA 13+). Other JetBrains IDEs of the same or higher version should be supported as well.
Compatibility Matrix:
Plugin Version | IDE Version Range |
---|---|
0.11.0 | IDEA 2018.2 |
0.9.0 | IDEA 2017.1 |
0.8.0 | IDEA 2016.1 |
0.6.0 | IDEA 13 - IDEA 15 |
IntelliJ IDEA should suggest you to install plugin automatically
when you open .proto
file.
You can install plugin manually by opening "Plugins" settings,
"Browse repositories..." - search for "Protobuf Support".
Plugin page: https://plugins.jetbrains.com/plugin/8277-protobuf-support
The plugin does not require configuration by default, for majority of projects it should work out of the box.
If you see 'File not found' error mark for the import statement, it means plugin cannot resolve target file within current set of source (or resource) roots.
In order to fix it, you should tell to plugin where is the "sources root" for your proto files.
There are a couple ways of doing that:
- Mark directory as a source/resources root (right click on folder in project structure, "Mark forlder as...."):
-
Configure directory as source/resources folder in
maven
/gradle
or other build system (if IDEA has support for that build system).For gradle you can do it like this:
idea { module { sourceDirs += file("${projectDir}/src/main/proto") } }
for maven, you can add as a resource directory:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>groupId</groupId> <artifactId>artifactId</artifactId> <version>1.0.0-SNAPSHOT</version> <dependencies> ... </dependencies> <build> <resources> <resource> <directory>src/main/proto</directory> </resource> </resources> </build> </project>
-
You can go to plugin settings, and add source roots there (this is also useful for external imports):
https://github.com/protostuff/protobuf-jetbrains-plugin/wiki/Roadmap
Run following command in the shell:
./gradlew build
It should be possible to run build on any platform (Linux, Windows, MacOS) where Gradle is supported.
JDK 8 must be installed and available on PATH in order to build plugin.
./gradlew runIdea