The junit task accepts nested sysproperty elements.
sysproperty
<junit fork="no"> <sysproperty key="mydatadir" value="${whatever}"/> ...</junit>
You can access these from within your tests using System.getProperty().