-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for using proto artifact dependencies #26
Comments
Hi, |
I'm trying something like <dependencies>
<dependency>
<groupId>test</groupId>
<artifactId>model</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>proto</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protoc.version}: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> Doesn't seem to generate anything |
If your project itself does not contain any proto sources and all proto sources are instead sitting inside the dependency artifact, then nothing will be compiled. You will have to pull the artifact down and unpack it into your build directory using |
Any way that can be done automatically by the plugin instead? |
No. It would be pretty un-maven, because it'd unnecessarily overcomplicate the plugin's logic and configuration (currently, people pull dependency artifacts to use as imports, not to compile them). If you look at other maven plugins ( |
btw --
They create a separate dependecy type to compile proto only dependencies |
@sergei-ivanov could you please provide an example on how to import a proto that has been defined in a different project? |
@luigi-riefolo you can browse through integration tests (src/it/...), there is plenty of examples there, with reactor projects and 3rd party dependencies. In particular, this test is a perfect example that also demonstrates how packages are resolved. The main requirement is that if a protobuf package is declared in the proto file, it must match its subdirectory under So if you have in your package it.project1; ... then the proto file should reside in import "it/project1/test1.proto"; I hope that helps. |
I would like to use same proto file for client and server generation.
The only working way to share proto file between server and client is to unpack it to some directory and add it as Why it is a problems to take proto from dependencies? Plugin already take proto files from dependencies and unpack them to |
Similar to https://github.com/google/protobuf-gradle-plugin#protos-in-dependencies add ability to reference artifact dependencies (in the form of tar.gz or zip archives) to be used as sources of *.proto files.
The text was updated successfully, but these errors were encountered: