How to put this unix command in ant script?
jar -xvf test.ear out.war | jar -x ; cd directory ; jar -xvf ../out.war
Will this work?
<target name="unear">
<echo>***Un-tarring***</echo>
<exec executable="jar" outputproperty="noOfFiles">
<arg value="-xvf" />
<arg value="test.ear out.war" />
<arg value="|" />
<arg value="jar" />
<arg value="-x" />
<arg value=";" />
<arg value="cd directory" />
<arg value=";" />
<arg value="jar" />
<arg value="-xvf" />
<arg value="../out.war" />
</exec>
</target>
wars, ears and jars are simply zip files. you can use the unzip task to crack it open. You'll need to break up the unix command in your example into multiple tasks.
May be You can do something like this, just to ensure you are running unix commands on Unix OS & you can run any set of unix commands by wrapping inside a script :
Pipes are interpreted by the shell, so make the shell interpret those. Say: