Ant:问题:无法创建任务或键入 propertyregex

编程入门 行业动态 更新时间:2024-10-28 09:18:29
本文介绍了Ant:问题:无法创建任务或键入 propertyregex的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送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:关键词]

本文发布于:2023-04-20 11:35:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/983937.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Ant   propertyregex

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!