Mac Idea Plugin--protobuf plugin

Source: Internet
Author: User

Recently in a PB version of the upgrade, The history of PB version is 2.4, is now intended to upgrade to 3.2, of course, PB version certainly has a lot of changes, it is no longer here to say, here is the key to say, the use of idea plug-in to facilitate the implementation of PB files Java compilation, so that, do not have to execute the command, while you can compile multiple PB files.

First step: Install the Plugin

Step Two: Configure the Pom file

<dependency>            <groupId>com.google.protobuf</groupId>            <artifactid>protobuf-java </artifactId>            <version>3.1.0</version>        </dependency>        <dependency>            <groupId>io.grpc</groupId>            <artifactId>grpc-netty</artifactId>            < version>${grpc.version}</version>        </dependency>        <dependency>            <groupId> io.grpc</groupid>            <artifactId>grpc-protobuf</artifactId>            <version>${ grpc.version}</version>        </dependency>        <dependency>            <groupId>io.grpc< /groupid>            <artifactId>grpc-stub</artifactId>            <version>${grpc.version}</ Version>        </dependency>

<Build>        <Extensions>            <extension>                <groupId>Kr.motd.maven</groupId>                <Artifactid>Os-maven-plugin</Artifactid>                <version>1.4.1.Final</version>            </extension>        </Extensions>        <Plugins>            <plugin>                <groupId>Org.xolstice.maven.plugins</groupId>                <Artifactid>Protobuf-maven-plugin</Artifactid>                <version>0.5.0</version>                <Configuration>                    <protocartifact>Com.google.protobuf:protoc:3.1.0:exe:${os.detected.classifier}</protocartifact>                    <pluginID>Grpc-java</pluginID>                    <pluginartifact>Io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} </pluginartifact>                </Configuration>                <executions>                    <Execution>                        <Goals>                            <goal>Compile</goal>                            <goal>Compile-custom</goal>                        </Goals>                    </Execution>                </executions>            </plugin>        </Plugins>    </Build>

Step three: Create a proto file

The contents of the Person.proto file are as follows:

Syntax = "Proto3"= "Com.ptest.proto"= "Personmodel"; message person {     = 1;      = 2;      = 3;}

Fourth step: Executing the MAVEN command (Protobuf:compile-javano)

Fifth step: Check the generated Java file (/target/generated-sources/protobuf/java/*)

Mac Idea Plugin--protobuf plugin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.