Closed wenweihu86 closed 5 years ago
You need to include google protobuf library as a dependency. You will need it in any case if you are going to generate and compile java sources. Everything else happens automatically.
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.6.1</version>
</dependency>
@sergei-ivanov thanks
@sergei-ivanov i tried the following pom.xml, but it failed.
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<clearOutputDirectory>false</clearOutputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
</plugin>
As I mentioned on Gitter, version 2.5.0
of protobuf library is very old and it may not have google/protobuf/descriptor.proto
file packaged. Check the contents of the JAR file.
If you really need to use that old protobuf library, you may need to roll your own JAR dependency with .proto
files for version 2.5.0
bundled into it.
ok,thanks
Is your feature request related to a problem? Please describe. In my proto file, I want to import protobuf include proto, such as: import "google/protobuf/descriptor.proto";
Describe the solution you'd like can config in pom.xml
Describe alternatives you've considered no
Additional context no