How to modify filename within <foreach> task

Help
2003-01-10
2004-05-06
  • Aaron Stromas
    Aaron Stromas
    2003-01-10

    Helo,

    Although I've been using Ant for some time, it was for simple things, and now I'm stumped.

    basically, I heve several se\ts of directury structures containing jars which I need to sign,  The signed jars have to go in the "signed" subdirectory of the directory containing the jar that is being signed.
    I'm using the <foreach> task to iterate over the directory sets.
    target that does the signing I have access to the file path of the jar being signed and the directory in whichit lives, e.g,,
    /a/b/c/some.jar and /a/b/c.
    What I cannot figure out is how to create the path /a/b/c/signed/some.jar.

    Since I'm in a loop I can't use named properties. The signjar tasl does not allow structured tasks for  any of its attributes...

    If someone has a suggestion, I'll be much obliged. TIA.

    -a

     
    • John Hopkins
      John Hopkins
      2004-02-17

      In the target which foreach calls, perhaps you can use the 'dirname' task which determines the directory path of a specified file.  Append "/signed" and "/some.jar".

       
    • Matt Inger
      Matt Inger
      2004-05-06

      <target name="sign.jar">
         <dirname property="jar.dir" file="${jar.path}" />
         <basename property="jar.name" file="${jar.name}" />

         <property name="signed.jar.path"
             location="${jar.path}/signed/${jar.name}" />

          <!-- sign the jar here -->
      </target>