ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claudio Corsi <cco...@progress.com>
Subject Re: passing paramter from ANT to shell script doesn't seems to work for me; Help !!!
Date Tue, 30 Sep 2003 18:54:03 GMT
Your exec element is not well formed. You are not nesting the env 
element within the exec element but within the target task.

Here is the correct format:

    <exec dir="${Deploy.scripts.folder}"
          executable="${Deploy.scripts.folder}/myshellScript.sh">
      <env key="SHAILESH" value="how are you????"/>
    </exec>

Shailesh Sharma wrote:

> As you said, i did the exact same thing.......
>  
> Yes, it is not working for me even with this simple example.
>  
>  
>  
>  
> build.xml file:
> ---------------------------------------------
> <?xml version="1.0" encoding="iso-8859-1"?>
> <project name="dev" default="all" basedir=".">
>     <property name="Deploy.scripts.folder" value= "/export/home/ext5sxs/scripts" />
> 
>     <target name="shaileshtest">
>         <echo message="This is the TESTNET box"/>
>         <exec dir="${Deploy.scripts.folder}" executable="${Deploy.scripts.folder}/myshellS
> cript.sh" />
> <env key="SHAILESH" value="how are you????"/>
> 
>     </target>
>     <target name="all" depends="shaileshtest" />
> </project>
>  
> ----------------------------
>  
>  
>  
>  
> myshellScript.sh
>  
> ------------------
> echo "Here is what the path====" $PATH
> echo "My env variable====" $SHAILESH
> --------------
>  
>  
> This is the same EXCEPTION:
> --------------------------
> ext5sxs@reliant2 bin> ant all
> Buildfile: build.xml
> shaileshtest:
>      [echo] This is the TESTNET box
>      [exec] Here is what the path==== /opt/bea/weblogic81/server/bin:/opt/bea/jdk141_03/jre/bin:/opt/bea/jdk141_03/bin:/opt/bea/weblogic81/server/bin:/opt/bea/jdk141_03/jre/bin:/opt/bea/jdk141_03/bin:/usr/bin:/usr/sbin:/opt/bea/weblogic81/server/bin:/usr/sbin:/usr/openwin/bin:/usr/ucb:/usr/ccs/bin:/usr/local/bin
>      [exec] My env variable====
> BUILD FAILED
> file:/export/home/ext5sxs/bin/build.xml:10: Could not create task or type of type: env.
> Ant could not find the task or a class this task relies upon.
> This is common and has a number of causes; the usual 
> solutions are to read the manual pages then download and
> install needed JAR files, or fix the build file: 
>  - You have misspelt 'env'.
>    Fix: check your spelling.
>  - The task needs an external JAR file to execute
>    and this is not found at the right place in the classpath.
>    Fix: check the documentation for dependencies.
>    Fix: declare the task.
>  - The task is an Ant optional task and optional.jar is absent
>    Fix: look for optional.jar in ANT_HOME/lib, download if needed
>  - The task was not built into optional.jar as dependent
>    libraries were not found at build time.
>    Fix: look in the JAR to verify, then rebuild with the needed
>    libraries, or download a release version from apache.org
>  - The build file was written for a later version of Ant
>    Fix: upgrade to at least the latest release version of Ant
>  - The task is not an Ant core or optional task 
>    and needs to be declared using <taskdef>.
> Remember that for JAR files to be visible to Ant tasks implemented
> in ANT_HOME/lib, the files must be in the same directory or on the
> classpath
> Please neither file bug reports on this problem, nor email the
> Ant mailing lists, until all of these causes have been explored,
> as this is not an Ant bug.
> Total time: 4 seconds
> 
>  
> ------------------------
>  
>  
>  
> Now what shall i do ??????????????????
>  
> -shailesh
>  
>  
> 
> 
> Claudio Corsi <ccorsi@progress.com> wrote:
> 
> You are saying that you nested env elements within the exec task and you 
> get this error.
> 
> I would recommend that you try to first use a simple script that just 
> echo an environment variable.
> 
> Run a target that uses this script.
> 
> Then use ant to pass the single environment variable to the script and 
> try it again.
> 
> Sometimes it is better to take a step back before jumping ahead.
> 
> Shailesh Sharma wrote:
> 
> 
>>yes ...i tried all probabilities....like using 
>>
>>
>>
>>
>>
>>
>>
>>
>>but it always gives me an error.....
>>
>>BUILD FAILED
>>file:/export/home/ext5sxs/bin/build.xml:41: Could not create task or type of type:
env.
>>Ant could not find the task or a class this task relies upon.
>>This is common and has a number of causes; the usual 
>>solutions are to read the manual pages then download and
>>install needed JAR files, or fix the build file: 
>>- You have misspelt 'env'.
>>Fix: check your spelling.
>>- The task needs an external JAR file to execute
>>and this is not found at the right place in the classpath.
>>Fix: check the documentation for dependencies.
>>Fix: declare the task.
>>- The task is an Ant optional task and optional.jar is absent
>>Fix: look for optional.jar in ANT_HOME/lib, download if needed
>>- The task was not built into optional.jar as dependent
>>libraries were not found at build time.
>>Fix: look in the JAR to verify, then rebuild with the needed
>>libraries, or download a release version from apache.org
>>- The build file was written for a later version of Ant
>>Fix: upgrade to at least the latest release version of Ant
>>- The task is not an Ant core or optional task 
>>and needs to be declared using .
>>Remember that for JAR files to be visible to Ant tasks implemented
>>in ANT_HOME/lib, the files must be in the same directory or on the
>>classpath
>>Please neither file bug reports on this problem, nor email the
>>Ant mailing lists, until all of these causes have been explored,
>>as this is not an Ant bug.
>>Total time: 5 seconds
>>
>>
>>
>>
>>
>>Claudio Corsi wrote:
>>Shailesh Sharma wrote:
>>
>>
>>>so what you are saying is ....i should not opt to use SHELL script and instead
use ....java task to invoke my weblogic.deploy utility ?
>>>
>>
>>
>>yes
>>
>>
>>
>>>if that is the case(and correct me if iam wrong), i don't want this......basically
we have shell scripts that iam trying to wrap up with ANT .....to better maintain with some
properties file and etc.
>>>
>>
>>
>>since, in this case, you are only using ant as a wrapper tool to calling 
>>your scripts then what you have looks fine.
>>
>>have you tried using this build file?
>>
>>
>>
>>>Claudio Corsi wrote:
>>>
>>>You should just use the java task in this case.
>>>
>>>You can define environment variables using nested env elements and it 
>>>contains attributes for the classpath, classname, and etc that you can use.
>>>
>>>Take a look at the ant manual http://ant.apache.org/manual/index.html 
>>>for an example.
>>>
>>>Click on "Ant Tasks"->"Core Tasks"->"java"
>>>
>>>
>>>Shailesh Sharma wrote:
>>>
>>>
>>>
>>>
>>>>Hi,
>>>>Thanks everybody for setting my unix environment. Although i have another
email stating the following problem but aim starting this as a new thread so as to be clear
what my problem is:
>>>>
>>>>
>>>>
>>>>what iam "trying" to do is to pass some variables from my ANT script to the
shell script. This is what iam doing with my 3 files.
>>>>
>>>>
>>>>
>>>>
>>>>1) build.xml file:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>>ions">
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>>l.deployment.script.name}" />
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------
>>>>2) myAnt.properties file:
>>>>
>>>>general.script=deployScript.sh
>>>>ANTPATCH=/opt/bea/wlserver6.1/lib/latest_deploy.jar
>>>>WEBLOGICJAR=/opt/bea/wlserver6.1/lib/weblogic.jar
>>>>ADMINPORT-NUMBER1=7001
>>>>HOSTNAME=reliant2
>>>>
>>>>
>>>>-----------------------------------------
>>>>3) deployScript.sh file:
>>>>
>>>>export ANTPATCH=$1
>>>>export WEBLOGICJAR=$2
>>>>export ADMINPORTNUMBER=$3
>>>>export HOSTNAME=$4
>>>>
>>>>
>>>>java -cp "$ANT-PATCH":"$WEBLOGIC-JAR" weblogic.deploy -port "$ADMIN-PORT-NUMBER"
-host "$HOSTNAME" -component testMon:beamon_biko_s1 deploy weblogic testMon /export/home/ext5sxs/applications/beamon/beaMon.war
>>>>
>>>>
>>>>-------------------
>>>>
>>>>
>>>>
>>>>
>>>>any help in this matter ??
>>>>
>>>>reagards,
>>>>
>>>>shailesh
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------
>>>>Do you Yahoo!?
>>>>The New Yahoo! Shopping - with improved product search
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>>---------------------------------
>>>Do you Yahoo!?
>>>The New Yahoo! Shopping - with improved product search
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>---------------------------------
>>Do you Yahoo!?
>>The New Yahoo! Shopping - with improved product search
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search



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


Mime
View raw message