在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):os72/protoc-jar-maven-plugin开源软件地址(OpenSource Url):https://github.com/os72/protoc-jar-maven-plugin开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):protoc-jar-maven-pluginProtocol Buffers protobuf maven plugin - performs protobuf code generation using protoc-jar multi-platform executable protoc JAR. Available on Maven Central: https://repo.maven.apache.org/maven2/com/github/os72/protoc-jar-maven-plugin/3.11.4/ Simple maven plugin to compile .proto files using protoc-jar embedded protoc compiler, providing some portability across the major platforms (Linux, Mac/OSX, and Windows). At build time the plugin detects the platform and executes the corresponding protoc binary. Supports embedded protoc versions 2.4.1, 2.5.0, 2.6.1, 3.11.4, and any binaries (protoc and protoc plugins) available for download from maven central. Also supports pre-installed protoc binary
See also
Binaries
UsageDocumentation: see http://os72.github.io/protoc-jar-maven-plugin/, in particular run-mojo Sample usage - compile in main cycle into <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin> Sample usage - compile in main cycle into <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<addProtoSources>all</addProtoSources>
<includeMavenTypes>direct</includeMavenTypes>
<includeDirectories>
<include>src/main/more_proto_imports</include>
</includeDirectories>
<inputDirectories>
<include>src/main/protobuf</include>
</inputDirectories>
</configuration>
</execution>
</executions>
</plugin> Sample usage - download protoc and plugin binaries from maven repo, multiple output targets (example: gRPC): <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.0.0</protocArtifact>
<inputDirectories>
<include>src/main/resources</include>
</inputDirectories>
<outputTargets>
<outputTarget>
<type>java</type>
</outputTarget>
<outputTarget>
<type>grpc-java</type>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.1</pluginArtifact>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin> Sample usage - javalite, multiple output targets: <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<inputDirectories>
<include>src/main/resources</include>
</inputDirectories>
<outputTargets>
<outputTarget>
<type>java</type>
<outputOptions>lite</outputOptions>
</outputTarget>
<outputTarget>
<type>python</type>
<outputOptions>lite</outputOptions>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin> Sample usage - compile in test cycle, multiple output targets, don't alter project ( <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-test-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<protocVersion>2.4.1</protocVersion>
<inputDirectories>
<include>src/test/resources</include>
</inputDirectories>
<outputTargets>
<outputTarget>
<type>java</type>
<addSources>none</addSources>
<outputDirectory>src/test/java</outputDirectory>
</outputTarget>
<outputTarget>
<type>descriptor</type>
<addSources>none</addSources>
<outputDirectory>src/test/resources</outputDirectory>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin> Sample usage - generate java shaded for use with <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<protocVersion>2.4.1</protocVersion>
<type>java-shaded</type>
<addSources>none</addSources>
<outputDirectory>src/main/java</outputDirectory>
<inputDirectories>
<include>src/main/protobuf</include>
</inputDirectories>
</configuration>
</execution>
</executions>
</plugin> CreditsOriginally based on |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论