Re: ant-contrib, iterating files
Christopher Heiny <[email protected]> Sun, 2 Mar 2008 11:42:05 -0800
| Newsgroups | gmane.comp.java.ant-contrib.devel |
|---|---|
| Organization | Jurassic Car Racing |
| Message-ID | <[email protected]> |
On Sunday 02 March 2008, ground control picked up the following
transmission from Thomas Rene Vervik:
> Hello
>
> I want to go through all the jar files in a give folder, unjar it,
> copy some class files to it, and jar it again. I have therefor made
> something like this:
>
> <for param="file">
> <path>
> <fileset dir="${suclient.home}/dist" includes="*.jar" />
> </path>
> <sequential>
> <echo>Filename === @{file}</echo>
> <mkdir dir="${suclient.home}/dist/tmp" />
> <unjar src="@{file}" dest="${suclient.home}/dist/tmp"/>
> </sequential>
>
> </for>
>
> But since I need to give the destination jar file the same name as
> the one I unjar'ed, I have to know the filename. With @{file} you get
> the whole path and file extension - I just want the name of the jar
> file. Anyone having suggestions how this can be done?
The documentation is your friend.
Check out the the <basename> ant task
http://ant.apache.org/manual/CoreTasks/basename.html
Your life might, or might not, be made easier by using the 'update'
paramter of the <jar> task.
http://ant.apache.org/manual/CoreTasks/jar.html
You might have to split the actions out into a separate target and
invoke that with <antcall>.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/