kshchepanovskyi / protostuff-googlecode-exported

Automatically exported from code.google.com/p/protostuff

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code generated doesn't compile repeated field with protoc 2.4.1 and protostuf 1.0.7

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?
1. Generate protoc
2. Run mvn plugin, see compile errors in project
3.

What is the expected output? What do you see instead?
Generated code does not compile. 

What version of the product are you using? On what operating system?
1.0.7, Mountain Lion

Please provide any additional information below.

Sample proto file:
package project;

option java_package = "com.example.project";
option java_outer_classname = "Configuration";
option optimize_for = SPEED;

message Definition {
    message Option {
        required string key = 1;
        required string display = 2;
        required string definition = 3;
        required bool required = 4;
    }

    required string class_name = 1;
    repeated Option option = 2;
}



Maven configuration used in project (Version set to 1.0.7 in build config): 
           <plugin>
              <groupId>com.dyuproject.protostuff</groupId>
              <artifactId>protostuff-maven-plugin</artifactId>
              <configuration>
                <protoModules>
                    <protoModule>
                        <source>src/main/protobuf/myproto.proto</source>
                        <outputDir>target/generated-sources</outputDir>
                        <output>java_v2protoc_schema</output>
                        <encoding>UTF-8</encoding>
                        <options>
                            <property>
                                <name>separate_schema</name>
                            </property>
                            <property>
                                <name>generate_field_map</name>
                            </property>
                        </options>
                    </protoModule>
                </protoModules>
              </configuration>
              <executions>
                <execution>
                  <id>generate-sources</id>
                  <phase>generate-sources</phase>
                  <goals>
                    <goal>compile</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>

Original issue reported on code.google.com by greg.whi...@gmail.com on 15 Mar 2013 at 10:26

Should note as well, the above bulids successfully if I comment out the 
'repeated Option option = 2;' line above

Original comment by greg.whi...@gmail.com on 15 Mar 2013 at 10:27

During the maven run, get the following error during the build (Ignore line 
numbers)

line 32:20 mismatched input 'option' expecting set null  

Original comment by greg.whi...@gmail.com on 16 Mar 2013 at 12:11

Changing the variable name to something other than 'option' seems to work as a 
workaround

Original comment by greg.whi...@gmail.com on 16 Mar 2013 at 12:25

Gah I posted on the wrong issue yesterday (Issue 131)
Repost here:

Yea this had been fixed for 1.0.8.
See http://code.google.com/p/protostuff/issues/detail?id=131

In the mean time, you can build the compiler jar yourself via:
cd protostuff-parser && mvn install
cd protostuff-compiler && mvn -Pjwd package

The output jar can be found in 
protostuff-compiler/target/protostuff-compiler-$version-jarjar.jar

Original comment by david.yu...@gmail.com on 17 Mar 2013 at 7:13

If using the maven plugin, exec "mvn install" on protostuff-compiler and then 
protostuff-maven-plugin afterwards.

Note that you can also specify the source as directory to avoid listing all 
your protobuf sources individually.  
E.g
<source>src/main/protobuf</source>

Original comment by david.yu...@gmail.com on 17 Mar 2013 at 7:23

  • Changed state: Accepted
Or you can use 1.0.8-SNAPSHOT, which is available in the central maven repos

Original comment by david.yu...@gmail.com on 17 Mar 2013 at 8:07

Awesome, thanks David!

Original comment by greg.whi...@gmail.com on 17 Mar 2013 at 12:22

Original comment by david.yu...@gmail.com on 29 May 2013 at 11:15

  • Changed state: Duplicate