【问题标题】:protoc jar maven plugin intellij not creating compiled proto filesprotoc jar maven插件intellij没有创建编译的proto文件
【发布时间】:2017-05-09 16:05:08
【问题描述】:

我正在尝试在 intelij 中使用 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 的原型文件。我的 pom.xml 中也有这个:

    <dependency>
        <groupId>com.github.os72</groupId>
        <artifactId>protoc-jar</artifactId>
        <version>3.1.0.1</version>
    </dependency>

这是原型:

package stringtest;

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

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

【问题讨论】:

  • 您找到解决此问题的方法了吗?我试图找出相同的...
  • 不幸的是,我没有。我想我只是要编写一个脚本来使用 protoc 并为我生成类。这很烦人,但至少它应该可以工作。

标签: maven intellij-idea protocol-buffers protoc


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-03-11
    • 1970-01-01
    • 2020-05-20
    • 2019-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多