gpt4 book ai didi

maven - protoc jar maven 插件 intellij 不创建已编译的 proto 文件

转载 作者:行者123 更新时间:2023-12-04 12:04:02 27 4
gpt4 key购买 nike

我正在尝试使用 protoc jar maven plugin在英特尔。我已将此添加到我的 pom.xml 中:

        <plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.1.0.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<includeDirectories>
<include>src/main/protobuf</include>
</includeDirectories>
<inputDirectories>
<include>src/main/protobuf</include>
</inputDirectories>
</configuration>
</execution>
</executions>
</plugin>

我有一个位于 src/main/protobuf 的 proto 文件.我的 pom.xml 中也有这个:
    <dependency>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar</artifactId>
<version>3.1.0.1</version>
</dependency>

这是原型(prototype):
package stringtest;

message StringObject {
repeated string string_one = 1;
repeated string string_two = 2;
repeated string string_three = 3;
}

但是,无论何时我右键单击我的模块并单击构建,或者如果我转到构建菜单并点击构建项目,我都看不到正在生成任何已编译的 protobuf 文件。我也没有看到任何错误。有谁知道我做错了什么?

最佳答案

确保您的 .proto 文件在您的资源文件夹中
当您运行 maven install 时,src/main/resources 和您的 pom.xml 可以位于 src 文件夹中的任何位置。您应该会看到生成了主 java 文件夹中的文件。

关于maven - protoc jar maven 插件 intellij 不创建已编译的 proto 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41310098/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com