Status: New
Owner: ken...@google.com
Labels: Type-Defect Priority-Medium

New issue 158 by cox.graham: Java code generated with 2.3.0 does not compile
http://code.google.com/p/protobuf/issues/detail?id=158

Using the maven2 plugin (From http://protobuf.googlecode.com/svn/branches/
maven-plugin/tools/maven-plugin) to automatically generate sources from
proto file in my source tree produces java code with many lines similar to

if (builder.mergeDelimitedFrom(input, extensionRegistry)) { // This is
line 1491
  return builder.buildParsed();
} else {
  return null;
}

giving a compile error of:

/home/graham/source/dystopia-j/messages/target/generated-sources/protoc/uk/
co/grahamcox/dystopia/network/messages/Dystopia.java:[1491,36]
incompatible types
found   : uk.co.grahamcox.dystopia.network.messages.Dystopia.PDU.Builder
required: boolean

My pom is configured with the following snippit:
      <plugin>
        <groupId>com.google.protobuf.tools</groupId>
        <artifactId>maven-protoc-plugin</artifactId>
        <version>0.0.2</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
              <protoSourceRoot>${basedir}/src/main/protobuf/</
protoSourceRoot>
              <includes>
                <param>**/*.proto</param>
              </includes>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <protocExecutable>/usr/local/bin/protoc</protocExecutable>
        </configuration>
      </plugin>

And running mvn -X produces the following configuration for running protoc
with.
[DEBUG] Configuring mojo 'com.google.protobuf.tools:maven-protoc-
plugin:0.0.2:compile' -->
[DEBUG]   (f) includes = [**/*.proto]
[DEBUG]   (f) outputDirectory = /home/graham/source/dystopia-j/messages/
target/generated-sources/protoc
[DEBUG]   (f) project = MavenProject:
uk.co.grahamcox.dystopia:messages:1.0-SNAPSHOT @ /home/graham/source/
dystopia-j/messages/pom.xml
[DEBUG]   (f) protoSourceRoot = /home/graham/source/dystopia-j/messages/
src/main/protobuf
[DEBUG]   (f) protocExecutable = /usr/local/bin/protoc
[DEBUG]   (f) temporaryProtoFileDirectory = /tmp/maven-protoc
[DEBUG] -- end configuration --

With protoc 2.2.0 installed, this generates source that builds fine. With
2.3.0 this generates the above source. The java project, maven
repositories, and maven plugins are exactly the same. Reverting back to
2.2.0 fixes the problem.


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.


Reply via email to