intellij IDE integration

2,174 views
Skip to first unread message

Suktae Choi

unread,
Aug 8, 2016, 1:33:11 PM8/8/16
to Protocol Buffers
 Hello, everyone.

Im trying to integrate protobuf automatically compiled in intellij IDE 2016.2.1 in mac edition.
I've installed two plug-in to let editor understand .proto extension files.

 - Google Protocol Buffers support
 - Protobuf Support

It seems fine in maven build time. but I want to make it auto-compiled when I change something in *.proto files and save.
It is successfully done in eclipse like following:


1. maven pom.xml configuration

## pom.xml
            <plugin>
                <groupId>com.google.protobuf.tools</groupId>
                <artifactId>maven-protoc-plugin</artifactId>
                <version>0.3.2</version>
                <configuration>
                    <protocExecutable>protoc</protocExecutable>
                    <protoSourceRoot>${project.basedir}/src/main/protobuf/</protoSourceRoot>
                    <outputDirectory>target/generated-sources/protobuf/java/</outputDirectory>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

2. eclipse configuration

1) turn on "build automatically"
2) set build_path of "protoc"


Is there any equivalent in intellij? I've been shared the same pom.xml file in project but It didnt compile .proto files automatically even though I turn on those settings:

1. preferences -> build -> compiler -> set "make project automatically" 
2. preferences -> build -> compiler -> protocol buffers compiler -> set build_path of "protoc"

Kostiantyn Shchepanovskyi

unread,
Aug 11, 2016, 3:23:25 PM8/11/16
to Protocol Buffers
"Protobuf Support" author here. I highly recommend you to disable/uninstall one of plugins, as they might conflict when enabled together (provided functionality is very similar, so there are conflicts). Test both plugins and select the best one :)

About your question, I'm not sure that it is possible to achieve same behavior as in Eclipse. 
According to documentation - https://confluence.jetbrains.com/display/IDEADEV/Maven+Integration+FAQ - you have to run maven goal manually.

Any time you want to generate sources you simply execute the corresponding goal, bound for generation (usually generate-sources, generate-test-sources). After that IDEA will pick up new folders and set them up.

You can find maven-protoc-plugin:compile goal on "Maven Projects" panel and run it. I think this is the most simple and fast way.

P.S. In the IntelliJ IDEA files are saved automatically, so you never need to press "save" button every 20 seconds. They explain it here: https://blog.jetbrains.com/webide/2009/10/do-not-bother-saving-files-anymore/ .

Suktae Choi

unread,
Aug 11, 2016, 11:00:41 PM8/11/16
to Protocol Buffers
Im glad to see comment from plugin author.
As your recommendation, I will remove one of those 2 plugins once I look into it carefully.

I also have reviewed following link you attatched of intellij maven integration, I figure out there is no way to make it built automatically at this time.
I will skip this trial at this stage as It doesnt take much effort to achieve it manually

I appreciate your reply, thanks.


Reply all
Reply to author
Forward
0 new messages