我正在使用maven生成一些protobuf python代码,但每次都会删除 init .py。
我想知道maven是否有一个工具可以创建一个空白 init .py,这样我就不需要每次都手动创建它。
(也许是来自其他 init .py的副本)
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.0</version>
<configuration>
<checkStaleness>true</checkStaleness>
<staleMillis>10000</staleMillis>
<protocExecutable>${protocLocation}</protocExecutable>
</configuration>
<executions>
<execution>
<id>compile protobuf</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
<goal>test-compile-python</goal>
</goals>
</execution>
<execution>
<id>compile-python</id>
<phase>initialize</phase>
<goals>
<goal>compile-python</goal>
</goals>
<configuration>
<checkStaleness>false</checkStaleness>
<outputDirectory>${pythonOutputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
这是生成代码并删除 init .py
的插件请注意,我将checkstaleness设置为false。这意味着它将写出protobuf文件,即使它们不超过某个时间。这是因为它没有检测到变化而没有将它们写出来。
编辑:
解决方案在这里找到: https://github.com/xolstice/protobuf-maven-plugin/issues/9
而不是创建新文件。我只是没有删除它。 (对于任何想要通过maven创建文件的人......继续搜索!)
答案 0 :(得分:0)
解决方案在这里找到: https://github.com/xolstice/protobuf-maven-plugin/issues/9
而不是创建新文件。我只是没有删除它。 (对于任何想要通过maven创建文件的人......继续搜索!)