编译protoc后,Java代码有很多错误

编译protoc后,Java代码有很多错误,java,protocol-buffers,Java,Protocol Buffers,为什么protoc生成的类会生成以下编译错误 Description Resource Path Location Type Cannot override the final method from GeneratedMessage AddressBookProtos.java /monitor/src/main/resources/com/example/tutorial line 102 Java Problem Cannot override the final method from

为什么protoc生成的类会生成以下编译错误

Description Resource Path Location Type Cannot override the final method
from GeneratedMessage AddressBookProtos.java
/monitor/src/main/resources/com/example/tutorial line 102 Java Problem
Cannot override the final method from GeneratedMessage
AddressBookProtos.java /monitor/src/main/resources/com/example/tutorial
line 339 Java Problem Cannot override the final method from
GeneratedMessage AddressBookProtos.java
还有我的pom.xml::

<dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.6</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <version>1.9.13</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>2.4.1</version>
        </dependency>
    </dependencies>

朱尼特
朱尼特
3.8.1
测试
org.slf4j
slf4j api
1.7.6
org.slf4j
slf4j简单
1.7.6
org.codehaus.jackson
杰克逊地图绘制者
1.9.13
com.google.protobuf
protobuf java
2.4.1

我认为您的pom文件与此无关。错误信息非常清楚:您无法覆盖最终方法。final一词用于避免重写的方法,因此删除final应该会有所帮助,否则包括代码。

您可能会遇到与此处相同的问题。试着使用protobuf java版本2.5.0。编译器libprotoc 2.6.1必须与protoc2.6.1jar配合使用。多谢洛蒂,我有一些与protobuf maven参考类似的东西,protoc版本在3.14.0匹配,这不是问题。也许我的描述不清楚。protoc complie java sorcecode…我想知道为什么生成的源代码有这么多错误!编译器libprotoc 2.6.1必须与protoc2.6.1jar一起出现错误是与protobuf一起出现的不是为什么代码不编译