- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 maven-antrun-plugin 生成使用 Apache 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 指定通配符?
最佳答案
您应该使用 maven thrift plugin .我假设 arg 转义 * 并按原样传递。您的第一个命令有效,因为 shell 确实为您扩展了 *。 Thrift 无法扩展通配符本身。
除此之外,目录的使用也大错特错。
编辑你的文件应该是:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<tasks>
<!-- always use properties if available -->
<mkdir dir="${build.directory}/generated-sources" />
<exec executable="${thrift.executable}" failonerror="true">
<arg value="--gen" />
<arg value="java:beans" />
<arg value="-o" />
<arg value="${build.directory}/generated-sources/thrift" />
<!-- since this is a special type of source, it has to be in its own dir -->
<arg value="src/main/thrift/*.thrift" />
</exec>
<!-- You never ever copy generated stuff back into src/* -->
<!-- use Build Helper Maven Plugin to add the generated source -->
<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>
关于java - Maven antrun 插件。将目录中的所有文件作为参数传递,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6781037/
我正在使用 Maven AntRun 插件 1.6 并且从他们的示例中我无法编写以下要执行的 ant 任务。 示例网址:http://maven.apache.org/plugins/maven-an
按照使用页面上的说明 (http://maven.apache.org/plugins/maven-antrun-plugin/usage.html) 和其他 Stackoverflow 问题,我
antrun 正在使用哪个版本的 ANT插件以及如何控制它以使用特定版本的 ANT 发行版。这个插件真的从本地发行版中获取 ANT 吗? 最佳答案 根据 Maven Central 中的信息,它使用的
我正在尝试使用 maven-antrun-plugin复制生成的.java文件到我当前的源目录。我的问题是生成了我要复制的路径目录的一部分。 我要复制的路径是这样的: ${project.build.
我正在将 ant 脚本转换为 Maven,并决定使用 Maven ant run 插件。我走的很好,但我遇到了以下问题。 Ant源脚本使用目标定义如下: 重点是使
我试图将Maven属性(通过配置文件定义)传递给antrun执行: org.apache.maven.plugins maven-antrun-plugin 1.7
我的 pom 中有以下内容: org.apache.maven.plugins maven-ant-plugin 2.3
我正在尝试设置 Maven 以在我的 Web 项目中的目录上执行 LESS CSS 预处理器。基本流程是: Maven 调用 maven-antrun-plugin。 Ant-contrib 循环遍历
如何禁用 maven-antrun-plugin当某个文件已经存在时执行?: [...] maven-antrun-plugin 1.6 test
我正在学习如何将 maven 用于我的独立 Java 应用程序,但我不明白如何将所有目录从/src/main/resources 递归复制到/taget 目录。 我尝试使用 antrun 和资源插件,
有一个多模块项目。在 child 内部,我需要做一些复杂的事情(集成测试与部署到应用程序服务器等)。所以有一个集成测试子模块,从这个模块我需要父模块的根才能到达其他模块。我不想使用“..”。 Inte
我想根据文件的可用性在 antrun 插件中执行“javac”。我们如何在 maven-antrun 插件中添加条件。 最佳答案 您可以在 Maven AntRun Plugin 的帮助下完成此操作.
我们在将 Ear 部署到服务器时遇到问题。不同环境(dev、int、acc等)的部署是有区别的。对于每个环境,我们部署到 1 个 weblogic 服务器。在某些情况下,还需要在第二台服务器上进行部署
我在我的 Maven 构建中使用 antrun 插件来替换 token @版本@ 在一些带有应用程序版本的 JSP 文件中。 这就是我正在做的: maven-antrun-plugin
我试图检查并查看是否在 maven-antrun-plugin 中设置了 MULE_HOME 环境变量但没有成功。这是我到目前为止所拥有的: org.apache.maven
我可以通过以下方式将两个属性 A 和 B 传递给 maven mvn test -DA=true 或 mvn test -DB=true 如果定义了 A 或 B,我希望跳过目标。我发现只有 A 被
如何从 maven-antrun-plugin 获取信息回到 Maven 脚本?例如: [...] maven-antrun-plugin 1.6 test
我正在使用 maven-antrun-plugin 生成使用 Apache Thrift 的类。当我将一个 thrift 文件指定为参数时该插件工作,但当我尝试使用通配符 (*) 为所有 thrift
我正在 Maven 中的 Ant 任务中复制一些文件,但我不知道如何告诉 ant 不要记录它正在复制一些文件的事实。 org.apache.maven.plugins maven-a
我已经将 jquery-ui 下载到我的 webapp 中,它有一个 build.xml用于压缩和缩小。 现在我想运行这个 build.xml来自我的 pom.xml : org.apa
我是一名优秀的程序员,十分优秀!