【发布时间】:2011-07-21 18:43:15
【问题描述】:
我正在使用 maven-antrun-plugin 使用 Apache Thrift 生成类。当我将一个 thrift 文件指定为参数时,该插件有效,但当我尝试使用通配符 (*) 为所有 thrift 文件生成代码时失败。我从命令行执行了 thrift:
thrift --gen java:beans src/main/resources/*.thrift
这行得通。
但是当我在 pom.xml 中定义这个插件时
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<mkdir dir="target/generated-sources" />
<exec executable="${thrift.executable}" failonerror="true">
<arg value="--gen" />
<arg value="java:beans" />
<arg value="-o" />
<arg value="target/generated-sources" />
<arg value="${basedir}/src/main/resources/*.thrift" />
</exec>
<copy todir="src/main/java" overwrite="true">
<fileset dir="target/generated-sources/gen-javabean" />
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
上述操作失败并出现错误“无法使用真实路径打开输入文件”。
如何使用 maven-antrun-plugin 指定通配符?
【问题讨论】: