我目前正在开发一个项目,该项目使用一种工具,该工具采用以下示例 IDL 文件并从中生成大约 5 个 Java 类。
结构示例{
诠释 x;
诠释y;
};
有没有办法让 Maven 使用我们用来在构建时自动创建这些 Java 类的命令行工具?
最佳答案
这是一个使用 Exec Maven Plugin 的例子.
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<!-- this execution happens just after compiling the java classes, and builds the native code. -->
<id>build-native</id>
<phase>process-classes</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>src/main/c/Makefile</executable>
<workingDirectory>src/main/c</workingDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
关于java - 有没有办法在 Maven 中执行一个程序来帮助构建你的项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8806795/