I’m trying to setup a build file and I was curious if you can use wildcards in a property to denote filepaths? Or what a better way to tackle this problem is?
As you can see below I want all the files or directories in ${dirtwo} that start with “foo-” to be resolved, versus having to manually include each directory/file as a property.
<?xml version="1.0" encoding="UTF-8"?>
<project name="core" default="build" basedir=".">
<property name="dirone" value="path/to/dir/one" />
<property name="dirtwo" location="path/to/dir/two/foo-*" />
<target name="phpmd" description="Generate pmd.xml using PHPMD">
<exec executable="phpmd">
<arg line="${dirone},${dirtwo}
xml
codesize,design,naming,unusedcode
--reportfile ${basedir}/build/logs/pmd.xml" />
</exec>
</target>
...
</project>
Currently, all I get are errors no matter how I try to use a wildcard or escape one.
Buildfile: /var/www/server/project/build.xml
phpmd:
[exec] The given file "/var/www/server/project/path/to/dir/two/foo-*" does not exist.
[exec] Result: 1
An Ant DirSet matches directories against includes/excludes patterns. You could combine it with Pathconvert as shown below.
To test the results of
dirsetandpathconvert, you can use: