Austin Brooks | 12 Jul 23:39 2016

Advice on how to achieve setting properties on an arbitrary class

What is the best way to achieve something that can resemble the following?

<healthCheck class="....urlCheck" serverPort="8080" path="/ping" />
<healthCheck class="....portCheck" serverPort="8080" />

Basically, I am trying to make an extendable health check task that takes a
class and is then configured using additional attributes or elements. I am
not overly restricted to a certain syntax.  The only real requirements I
have are:
1. Is extendable by passing any class to the class attribute
2. Custom class is not tied to ant, will pass configuration via hash map or
reflection property setting

So is there a way to configure this by sub-elements or defining a method
that is a collect all bucket for unknown attributes?

Rich Bowen | 12 Jul 21:58 2016

ApacheCon Europe call for papers open

As you are no doubt already aware, we will be holding ApacheCon in
Seville, Spain, the week of November 14th, 2016. The call for papers
(CFP) for this event is now open, and will remain open until 
September 9th.

The event is divided into two parts, each with its own CFP. The first
part of the event, called Apache Big Data, focuses on Big Data
projects and related technologies.


The second part, called ApacheCon Europe, focuses on the Apache
Software Foundation as a whole, covering all projects, community
issues, governance, and so on.


ApacheCon is the official conference of the Apache Software
Foundation, and is the best place to meet members of your project and
other ASF projects, and strengthen your project's community.

If your organization is interested in sponsoring ApacheCon, contact me
at evp <at>  ApacheCon is a great place to find the brightest
developers in the world, and experts on a huge range of technologies.

I hope to see you in Seville!
Cyril Scetbon | 15 Jun 22:11 2016

maven-ant-tasks proxy issue

Hi guys,

I have an issue with this code
I've tried to use http_proxy, ANT_OPTS, ANT_ARGS and JAVA_TOOL_OPTIONS without being able to force ant to
use my proxy to access the web.

Any idea ? I'd like a way that to do not requires to change files if possible.
Evan J | 1 Jun 00:26 2016

Declaring a byte[] Array in scriptdef

How can I declare a byte[] array inside of scriptdef when the language of
choice is javascript? Ant 1.8.1, The following line:

var bytebuffer = new byte[8192]; // line 36

Would give the following error:

:1126: javax.script.ScriptException: identifier is a
reserved word (<Unknown source>#36) in <Unknown source> at line number 36
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.lang.reflect.Method.invoke(
(Continue reading)

SCHOEPFLIN Markus | 24 May 13:53 2016

How to enable XInclude processing for schemavalidate task

Hello list,

I'm trying to enable XInclude processing in the schemavalidate task:

        noNamespaceFile="${user.input.xsd}" file="${user.input.xml}">
      <attribute name="" value="true"/>

This does not work, as I'm still getting an error when the task is executed: "foo.xsd:8:136:
s4s-elt-schema-ns: The namespace of element 'include' must be from the schema namespace, ''."

The corresponding schema file looks like this:

  <xs:schema xmlns:xs="" xmlns:xi="">
    <xi:include href="..." xpointer="xmlns(xs=*)"/>

When enabling Ant debug mode, I can see that the feature is correctly set on the parser:

[schemavalidate] Using SAX2 reader org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser
[schemavalidate] Setting feature
[schemavalidate] Setting feature
[schemavalidate] Setting feature
[schemavalidate] Setting feature
[schemavalidate] Setting feature
[schemavalidate] Validating foo.xml...

What am I missing? Or is this not supported?

(Continue reading)

Gilles Querret | 13 May 17:58 2016

Regexp mapper + Zip task on Windows


Using this test case, I see a different behavior on Windows and Linux ; I'm
creating two files, then generating a ZIP file (with regexpmapper to rename
files), wait a few seconds (just in case there's  FS timestamp problem) and
re-execute the same Zip task.
On Linux, the second Zip task doesn't do anything (as expected) as the
files are not modified.
On Windows, the Zip file is always updated. With -v, I'm getting :
      [zip] us/xx/xxtest.r added as us/xx/xxtest.r is outdated.
      [zip] us/zz/zztest.r added as us/zz/zztest.r is outdated.
Using Ant 1.9.7, JDK 1.8 on both systems.

Am I doing something wrong, or is there a bug ?

<?xml version="1.0" encoding="utf-8"?>
<project name="test">
 <mkdir dir="src" />
 <touch file="src/xxtest.r" />
 <touch file="src/zztest.r" />
 <zip destFile="">
    <fileset dir="src" includes="*.r" />
    <regexpmapper from="^(([a-z][a-z]).*)\.r" to="us/\2/\1.r" />
 <sleep seconds="5" />
 <zip destFile="">
    <fileset dir="src" includes="*.r" />
(Continue reading)

Dave Glasser | 1 May 06:06 2016

Order of attributes signifificant in zipfileset?

I discovered this in ant 1.6.5, and found that it still behaves this way in 1.9.7.
If you have a <zipfileset> element with both a dir and a file attribute, it will produce different results
depending on the order in which those attributes appear. If the file attribute appears first, it behaves
as you would expect. For example, with this:
<zipfileset file="file1.txt" dir="dir1"/>
It looks for a file named "file1.txt" inside the directory "dir1". However, with this:
<zipfileset dir="dir1" file="file1.txt"/>
It looks for file1.txt inside the current working directory. This can be verified by running the
demonstration target I provide below with the -debug switch, and reading the debug output.
I want to make clear that I'm aware that the docs for fileset say:
"Either dir or file must be specified" and that I might be doing it wrong. You could argue otherwise, but
perhaps that does in fact unambiguously imply that having both is incorrect and hence the behavior is
undefined. Be that as it may, what I would like to know is this:
Is this a known, and expected behavior?  Is it documented anywhere?
Should I assume that the order of attributes is significant in other places throughout my build.xml file?
Here's a self-contained target that demonstrates this behavior:
  <target name="oa">
    <property name="JARCMD" value="jar"/>

    <!-- Delete both zip files if they exist. -->
    <property name="ZIP1" value=""/>
    <property name="ZIP2" value=""/>
    <delete file="${ZIP1}"/>
    <delete file="${ZIP2}"/>

    <property name="DIR1" value="dir1"/>
    <mkdir dir="${DIR1}"/>

    <!-- make sure there are no files named file1.txt or file2.txt in the
         current directory, so we know they're not being read from there. -->
(Continue reading)

Lancelot.MEURILLON | 26 Apr 11:25 2016

Multiple fileset and filelist comparisons

Hi all,

How would you  do to implement this with ANT ?

1- In a project A, there are 2 file trees with same directories and files but not at same revision
-----file1 (version 1.2)
-----file2 (version 2.3)
-----file3 (version 3.0)

-----file1 (version 1.2)
-----file2 (version 2.1)
-----file3 (version 3.0)

I need to compare those 2 file trees to get desynchronized files from 'DirRemote' (in order to synchronize
them with the latest revision further).
I can do this easily with 'different' selector on 'targetdir' DirRemote :
<fileset dir="${DirLocal}" includes="**/*.xml" id="desynchronizedMetadata">
    <different targetdir="${DirRemote}" ignoreFileTimes="true"/>

But this list of desynchronised files will be used by another project B, that's why I convert the fileset
'desynchronizedMetadata into a fileList using a pathconvert and echo file :
<pathconvert pathsep="${line.separator}" property="desynch.files" refid="desynchronizedMetadata">
    <regexpmapper from="^${DirLocal}/(.*)$" to="&lt;file name=&quot;\1&quot;/>" handledirsep="true"/>
(Continue reading)

Al Le | 26 Apr 08:53 2016

How to create a task associated a target


in my ant script, I do the following:

1. there is a target "calledTarget"

2. there is a task "macroTask", defined via "macrodef". This task contains in its body a call to
"calledTarget" (via "antcall").

3. there is a target "mainTarget" which contains a task "script" (javascript). In this script, I create an
instance of macroTask and then execute it.

Here's the picture as an outline:

<project default="mainTarget">

    <target name="mainTarget">
        <script language="javascript">
            var task = project.createTask("macroTask");
            // task.setOwningTarget(project.getTargets().get("mainTarget")); // This must be done to avoid NPE

    <macrodef name="macroTask">
            <antcall target="calledTarget"/>

(Continue reading)

KM | 18 Apr 21:00 2016

Ant 1.9.7, issue with evaluation of double quotes

 All As per the WHATSNEW file I see that one of the issues modified the interpretation/evaluation of quotes
within an ant argument, e.g.:
 * Ant fails to run when arguments contain double-quote character.
   Bugzilla Report 58898
I've requested a bugzilla login account and was planning to add a comment to this bug report, but I figured
I'd just post this here.
Previously with ant 1.9.6 and earlier the line expanded to -Dbr.cmd="co-r ", which is correct.   Now
afterupdating to Ant 1.9.7 the expansion is messed up.  It actually evaluates to '-Dbr.cmd="co'-r ' "
'  including all of thequotes shown.  It’s hard to read so I addedspaces around the one double quote at
the end.  It actuallylooks like ‘”’.  Then ant gives the error -r option invalid.  
I am assuming it's the modifications for 58898 that are causing this.   
Needless to say, that I can modify the scripts we use, so the field itself does not contain the double quotes,
and that the field is only surrounded by them.  But I was surprised that my build failed almost
immediately as ant was kicked off.
Is anyone else seeing issues with double quotes in Ant 1.9.7? Thanks, just wanted to supply the info.KM

Stefan Bodewig | 12 Apr 20:03 2016

[ANN] Apache Ant 1.9.7 Released

The Apache Ant Team is pleased to announce the release of Apache Ant

Version 1.9.7 is mostly a bug fix release but adds a few new features
like support for arbitrary filesyste resources in <scp> and initial
support for Java9 modules.

Apache Ant is a Java library and command-line tool that helps building

Source and binary distributions are available for download from the
Apache Ant download site:

When downloading, please verify signatures using the KEYS file available
at the above location when downloading the release.

Changes in this version include:

Changes that could break older environments:

 * <exec> and <apply> used to ignore the dir attribute if it was the
   same as the current working directory.  They now no longer do,
   which changes the behavior for vmlauncher="false" which would have
   used the project's basedir rather than the current working
   directory in that case.
(Continue reading)