macrodef 定義:
- <macrodef name="mklink">
- <attribute name="resource" />
- <attribute name="link" />
- <sequential>
- <if test="${is.unix}">
- <then>
- <symlink link="@{link}" resource="@{resource}"/>
- </then>
- <else>
- <path id="id.link.path">
- <pathelement location="@{link}"/>
- </path>
- <path id="id.resource.path">
- <pathelement location="@{resource}"/>
- </path>
- <pathconvert targetos="windows" property="link.path" refid="id.link.path">
- <!-- ${wl.home} が 値 d:\weblogic を持ち、 ${wl.home.unix} が /weblogic を持つとしています。 -->
- <!-- map from="${wl.home}" to="${wl.home.unix}"/ -->
- </pathconvert>
- <pathconvert targetos="windows" property="link.resource" refid="id.resource.path"/>
- <echo message="link.path=${link.path}, link.resource=${link.resource}"/>
- <exec dir="${basedir}" executable="cmd.exe">
- <arg line="/c mklink ${link.path} ${link.resource}"/>
- </exec>
- </else>
- </if>
- </sequential>
- </macrodef>
使用例: NOTE: proguard*.jar のようなパターンは使えない.
<target name="resolve-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve/>
<delete dir="${project.lib.dir}" includes="proguard.jar"/>
<mklink link="${project.lib.dir}/proguard.jar" resource="${project.lib.dir}/proguard-anttask-5.2.1.jar"/>
</target>