i used "m2 ant:ant" to create a ant build file, and found the following line:
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
but i had changed the "localRepository" to another directory with the "settings.xml" file, so i have to correct it manually!
I hope ant:ant plugin would read the "settings.xml" file to set the "maven.repo.local" property.
Perhaps we could write the property to build.properties instead, and restore the default in the script?