1

I have a proto file defined with syntax = "proto3" where I have a field optional String name = 0; for example. When compiling the file with protoc installed on the machine I get Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default.. When running a maven clean install with the maven compiler I don't get this error. The pom configuration is as follows :

<plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.6.1</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>test-compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <additionalProtoPathElements>
                        <additionalProtoPathElement>${project.basedir}/src/main/proto</additionalProtoPathElement>
                    </additionalProtoPathElements>
                    <protocArtifact>com.google.protobuf:protoc:3.21.1:exe:${os.detected.classifier}</protocArtifact>
                </configuration>
            </plugin>

Can someone please help ?

1 Answers1

1

Topic closed. Apparently the new proto compilers (3.21.1 ) do not report optional as a problem whilst older (3.0.2)