Ant: Problem: Could not create task or enter regex property

I am using Ant 1.8.1. I 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: Could not create task or enter property regex. Reason: Name is undefined." after running my Ant build file. What else do I need to do to recognize this task?

+8
ant
source share
2 answers

The propertyregex ant task is part of ant-contrib and is not included by default in any apache-ant .

You must install ant-contrib correctly. On the ant-contrib page, you have two options:

  • Copy ant-contrib-0.3.jar to the lib directory of your Antmount. 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 assembly file.

  • Keep ant-contrib-0.3.jar in a separate place. Now you should 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>

+12
source share

I leave it here. Some time ago I experienced a similar error when I tried to compile my python project in IntelliJ IDEA. In my case, it was required to specify a custom Ant (check the Use custom Ant box) instead of the standard one. After I made these updates, everything worked fine. Please find the screenshot below. enter image description here

It worked for me, hope it will be useful.

+2
source share

All Articles