Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ngerakines/maven-protobuf
A maven plugin to generate java sources from protocol buffers .proto files using protoc.
https://github.com/ngerakines/maven-protobuf
Last synced: about 1 month ago
JSON representation
A maven plugin to generate java sources from protocol buffers .proto files using protoc.
- Host: GitHub
- URL: https://github.com/ngerakines/maven-protobuf
- Owner: ngerakines
- License: mit
- Created: 2013-12-02T17:06:32.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2013-12-04T20:37:36.000Z (about 11 years ago)
- Last Synced: 2024-05-01T13:43:26.439Z (8 months ago)
- Language: Java
- Homepage:
- Size: 219 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# About
This project provides a lightweight maven plugin that can be integrated into
maven projects to compile protocol buffers .proto files.# Usage
Consider the following configuration added to a pom.xml file:
/usr/bin/protoc
protobuf-build
com.socklabs
maven-protobuff
develop-SNAPSHOT
generate-sources
generate-sources
src/main/resources/com/socklabs/elasticservices/core/service.proto
compile
What we've done is created a profile that, when enabled, will automatically
compile the listed .proto sources into the src/main/java directory relative
to the pom file. This plugin is configurable and can be extended to include
additional source files and include files as well as set the location of
generated sources.To change the location that generated source files are placed, set the
*protoOutput* configuration value. The default value is **src/main/java**.target/generated-sources/proto
## Multi Modules
**Note:** If you are building a multi-module project, you may need to make
includes explicit. You must include the current include path as well as any
additional include paths used.For example, if I've got two modules, foo and bar, that both have .proto
files and the bar module's proto files depend on the foo module's proto files
the directory structure would look something like this:parent/foo/src/main/resources/com/socklabs/foo/foo.proto
parent/bar/src/main/resources/com/socklabs/bar/bar.protoIn the bar.proto, the import directive needs to include the full path
starting at the base parent/foo/src/main/resources directory.import "com/socklabs/foo/foo.proto";
package com.socklabs.bar;
option java_package = "com.socklabs.bar";
option java_outer_classname = "BarProto";In the pom.xml of the bar module, the configuration needs to reflect the
include paths of both the current module and the imported modules's proto
files.
src/main/resources/com/socklabs/bar/bar.proto
src/main/resources
../foo/src/main/resources
# License
Copyright (c) 2013 Nick Gerakines
This project and its contents are open source under the MIT license.