Title: Set properties.

Hi,
I  am quite new with Ant, and I have some problems.
I am trying to use the same target from two different ones; setting some parameters, and execute or not this last target depending of one of the parameters.

This is the code:

    <target name="chek_junit"> 
          <available file="${junit.jar}"  property="junit.jar.present"/>
          <echo message="Junit present; ${junit.jar.present}"/>
          <antcall target="get_jar">
            <param name="present" value="${junit.jar.present}"/>
            <param name="project.name" value="${Junit.project.name}"/>
            <param name="jar.name" value="${junit.jar}"/>
           </antcall>

   </target>  
              
    <target name="check_log4j"> 
          <available file="${log4j.jar}"  property=" log4j.jar.present "/>
          <echo message="Log4j present: ${log4j.jar.present}"/>
          <antcall target="get_jar">
         
            <param name="present" value="${log4j.jar.present}"/>
            <param name="project.name" value="${log4j.project.name}"/>
            <param name="jar.name" value="${log4j.jar}"/>
           </antcall>
   </target>  
  

<target name="get_jar" unless="present">  
        .....
</target>

The problem is that when one of the files doesn't exists, the property is not set , and the value that the parameter take is literally "${log4j.jar.present}", and the target "get_jar" is never executed, because present is alredy set.

Is there any way to do this, without having to write other target ? I am doing something wrong?
Thanks in advance,
Natalia

Reply via email to