You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Shweta Bodade <sb...@businessobjects.com> on 2006/02/27 07:30:47 UTC

Urgently help needed on condition task .

            

Hello ,

 

      Please help needed urgently 

Can you find bug in this code 

Because its not getting executed 

I want to deploy my application in either tomcat or weblogic

Depending on user i/p

 

But when I give i/p as 1 or 2 it does not go to respective target.

Am I missing something. Its real urgent any help would be great 

 

 

<target name="select_target">                                    

                        <input message="Which server should receive the
files? 1.Tomcat   2.weblogic"

                         validargs= "1,2"

                         addproperty="server.choice"/>

            

                        <condition property="servername" value="Tomcat">

                               <equals arg1="${server.choice}"
arg2="1"/>                             

                         </condition>

            

                        <condition property="servername"
value="weblogic">

                              <equals arg1="${server.choice}" arg2="2"/>

                         </condition>           

            </target>     

            

            

            <target name="deploy_target_weblogic"
depends="select_target" if="weblogic">    

                  <echo message="yes"/>

                  <property file="./deployment.properties"/>

                  <ant antfile="${path_for_Weblogic_buildFile}"
target="deploy_WebLogic">      </ant>      

            </target>

 

      

            <target name="deploy_target_tomcat" depends="select_target"
unless="weblogic">

              <echo message="no"/>

                  <property file="./deployment.properties"/>

                  <ant antfile="${path_for_tomcat_buildFile}"
target="tomcat_deploy">      </ant>      

            </target>

 

 

 

 

Thanx in advance.

Shweta.


Re: Urgently help needed on condition task .

Posted by Robert Clark <ro...@quest.com>.
On Monday February 27, 2006 01:30, "Shweta Bodade" 
<sb...@businessobjects.com> wrote:
> But when I give i/p as 1 or 2 it does not go to respective target.
> Am I missing something. Its real urgent any help would be great

[ SNIP ]

Below you are setting the property "servername" to Tomcat if the
use selected Tomcat.

>    <condition property="servername" value="Tomcat">
>       <equals arg1="${server.choice}" arg2="1"/>
>    </condition>

Below you are setting the property "servername" to weblogic if the
use selected Weblogic.

>   <condition property="servername" value="weblogic">
>      <equals arg1="${server.choice}" arg2="2"/>
>   </condition>
>

And here you are executing the target only if the property "weblogic" 
is set, but you are never setting this property.

>    <target name="deploy_target_weblogic" depends="select_target"
>              if="weblogic"> 

>             </target>
>

I'd suggest something like the following:

    <condition property="deploy.to.tomcat">
        <equals arg1="${server.choice}" arg2="1"/>
    </condition>
    <condition property="deploy.to.weblogic">
        <equals arg1="${server.choice}" arg2="2"/>
    </condition>
    
    <target name="deploy_target_weblogic" depends="select_target"
            if="deploy.to.weblogic">
        [ ... ]
    </target>
    <target name="deploy_target_tomcat" depends="select_target"
            if="deploy.to.tomcat">
        [ ... ]
    </target>

- Rob

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org