<target name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target name="-init-project" depends="-init-user">
<property file="nbproject/project.properties"/>
</target>
<target name="-init-check" depends="-init-user,-init-project">
<fail unless="src.dir">Must set src.dir</fail>
</target>
<target name="init" depends="-init-user,-init-project,-init-check"/>
<target name="bld_all" depends="init">
<exec dir="${src.dir}" executable="perl5">
<arg line="bld all"/>
</exec>
</target>
现在,如果我在此脚本中放置一个print来从脚本的环境中返回当前工作目录的值,它会显示它在$ {ANT_HOME} / bin中运行,而不是在$ {src.dir}中运行,因为它应该是,这导致脚本无法执行构建。但只是为了让我疯了,如果我直接执行下面的pwd命令,它会返回正确的目录。
<target name="pwd_test" depends="init">
<exec dir="${src.dir}" executable="pwd"/>
</target>
这里发生了什么?