Thursday, October 28, 2010

Ant on OS X

I ran into this last night and scratched my head for a little while, so this is for anyone else who runs into this:

I have a Java project that I build with Ant on my OS X machine. It compiles and produces a war file called "project_client.war". After the most recent OS X update late last week, that stopped working. Instead, it started producing a war file called "project_${}.war".


Here's the relevant ant task:

<target name="buildWarFile">
<delete file="${current.war}" failonerror="false" />

<war destfile="${current.war}" webxml="${current.resources}/facilitate_core/resources/facilitate.xml" duplicate="preserve" update="false">
<fileset dir="${current.resources}/${current.secondary_resource_dir}/html" />
<fileset dir="${current.resources}/facilitate_core/html" />
<webinf file="${}/templates.jar" prefix="WEB-INF/lib/" />
<webinf dir="${current.resources}/${current.secondary_resource_dir}/resources/templates" prefix="WEB-INF/resources/templates/" />
<webinf dir="${current.resources}/facilitate_core/resources/templates" prefix="WEB-INF/resources/templates/" />
<webinf file="${current.jars}/velocity-1.4-p1.jar" prefix="WEB-INF/lib/" />
<classes dir="${}">
<include name="com/spun/**" />
<target name="pushWarFile">
<isset property="" />
<ssh host="${}" username="${current.ssh.userName}" password="${current.ssh.password}" version="2">
<sftp action="put" remotedir="${current.ssh.remoteDir}" verbose="true">
<fileset file="${current.war}" />

That references two properties files, a (read in first) and a (read in second).

This is

This is

When I ran the ant task with -v, it showed an error:
" is not defined"

Well, that's funny. This worked just before the update, with no code change. Also, I see name right there - it's defined!

The trick turned out to be removing "current" from the war property, making look like this:

And that did it. My best guess is that it's something that has to do with the new namespaces features for properties in ant. But if anyone else runs into something like this, maybe this will help.

No comments:

Post a Comment