How do I refer to protobuf definitions in another module in Maven?

260 views
Skip to first unread message

Derek Ealy

unread,
Dec 4, 2013, 1:52:47 PM12/4/13
to prot...@googlegroups.com
Hi

I have a project made up of several modules. Up until now all of my protobuf files have all been defined together in the same module A, so them referring to each other via import statements has not been difficult. Module A has many proto files all packaged into a zip file something like A-1.3-SNAPSHOT-protobuf-src.zip, this zip file has asset.proto

However now I have created a new proto file in a second module B and it needs to reference one of the definitions in A. In B.proto I try to import it using import "asset.proto";

In B.pom I've defined a dependency on A-1.3 SNAPSHOT, the pom looks something like this:

<plugins>
         <plugin>
            <groupId>com.github.igor-petruk.protobuf</groupId>
            <artifactId>protobuf-maven-plugin</artifactId>
            <executions>
               <execution>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
            <configuration>
               <inputDirectories>
                  <file>src/main/resources/protobuf</file>
               </inputDirectories>
               <outputDirectory>${generated.source.output.dir}</outputDirectory>
            </configuration>
         </plugin>
</plugins>

<dependencies>
  <dependency>
         <groupId>com.google.protobuf</groupId>
         <artifactId>protobuf-java</artifactId>
   </dependency>
   <dependency>
         <groupId>com.company</groupId>
         <artifactId>A</artifactId>
         <version>1.3-SNAPSHOT</version>
    </dependency>
</dependencies>


When I run maven I always get the error that asset.proto: File not found.

Can someone please explain the proper way to refer to other external proto files?

Thanks, Derek

Reply all
Reply to author
Forward
0 new messages