问题描述
限时送ChatGPT账号..我使用的是 Ant 1.8.1.我已经下载了 ant-contrib-1.0b3.jar 并将它放在我的 $ANT_HOME/lib 目录中.但是,当我将其包含在我的 build.xml 文件中时...
我收到错误消息问题:无法创建任务或键入 propertyregex.原因:名称未定义."在运行我的 Ant 构建文件时.我还需要做什么才能使这项任务得到认可?
解决方案propertyregex
ant 任务是 ant-contrib,默认情况下不包含在任何 apache-ant 安装中.
您必须正确安装ant-contrib
.从 ant-contrib 页面,您有两个选择:
复制ant-contrib-0.3.jar
到你的Ant的lib目录下安装.如果您想在自己的项目中使用其中一项任务,添加行 <taskdefresource="net/sf/antcontrib/antcontrib.properties"/>
到您的构建文件.
将 ant-contrib-0.3.jar
保存在单独的位置.你现在必须明确告诉 Ant 在哪里可以找到它(比如在 /usr/share/java/lib
中):
<代码><路径元素location="/usr/share/java/lib/ant-contrib-0.3.jar"/>
I'm using Ant 1.8.1. I have downloaded ant-contrib-1.0b3.jar and placed it in my $ANT_HOME/lib directory. However, when I include this in my build.xml file ...
<propertyregex property="selenium.email.success.subject"
input="package.ABC.name"
regexp="(.*)__ENV__(.*)"
replace="\1${buildtarget}\2"
override="true"
casesensitive="false" />
I get the error "Problem: failed to create task or type propertyregex. Cause: The name is undefined." upon running my Ant build file. What else do I need to do to get this task recognized?
解决方案The propertyregex
ant task is part of ant-contrib, and not included by default in any apache-ant installation.
You have to properly install ant-contrib
. From the ant-contrib page, you have two choices:
Copy
ant-contrib-0.3.jar
to the lib directory of your Ant installation. If you want to use one of the tasks in your own project, add the line<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
to your build file.Keep
ant-contrib-0.3.jar
in a separate location. You now have to tell Ant explicitly where to find it (say in/usr/share/java/lib
):
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="/usr/share/java/lib/ant-contrib-0.3.jar"/>
</classpath>
</taskdef>
这篇关于Ant:问题:无法创建任务或键入 propertyregex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论