我在我的POM中配置了协议缓冲区编译器插件,每当项目构建时它就会被执行。这个编译器插件在Windows上运行良好,但现在我把我的项目迁移到了Ubuntu PC上,需要使用一个合适的替代品。
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>compile-protoc</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<mkdir dir="src/main/resources/protocolBuffers/compiled" />
<path id="proto.path">
<fileset dir="src/main/proto">
<include name="**/*.proto" />
</fileset>
</path>
<pathconvert pathsep=" " property="proto.files" refid="proto.path" />
<exec executable="src/main/resources/protocolBuffers/compiler/protoc" failonerror="true">
<arg value="--java_out=src/main/resources/" />
<arg value="-I${project.basedir}/" />
<arg line="${proto.files}"/>
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
当我在Ubuntu netbeans中尝试构建项目时,我看到了以下输出。
--- maven-antrun-plugin:1.3:run (compile-protoc) @ Px10App ---
Executing tasks
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 5.638s
Finished at: Tue Mar 25
Final Memory: 9M/105M
------------------------------------------------------------------------
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.3:run (compile-protoc) on project Px10App: An Ant BuildException has occured: Execute failed: java.io.IOException: Cannot run program "src/main/resources/protocolBuffers/compiler/protoc": error=2, No such file or directory -> [Help 1]
如何在Ubuntu netbeans中使用编译器插件?