ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bret Marzolf" <marzo...@excite.com>
Subject Environment.Variable in dynamic exec task within the script task
Date Fri, 26 Dec 2003 17:53:16 GMT
 I'm trying to recreate the following in the build.xml using the &lt;script&gt; task
and javascript: &lt;exec executable="${exe_location}" dir="${exe_dir}"&gt;  &lt;env
key="${env_var_key}" value="${env_var_value}"/&gt;  &lt;arg value="${arg1}"/&gt;
 &lt;arg value="${arg2}"/&gt;&lt;/exec&gt; Here's what I tried to do: &lt;target
name="testme"&gt;&lt;script language="javascript"&gt; &lt;![CDATA[  execTask
= MyProject.createTask("exec");  MyTarget.addTask(execTask);    execTask.setExecutable(  
 MyProject.getProperty("exe_location"));    execTask.setDir(    new java.io.File(MyProject.getProperty("exe_dir")));
   // simulate &lt;env&gt; child element of &lt;exec&gt; task    // ----------------
 // Try #1:  envVar = new org.apache.tools.ant.types.Environment.Variable;      // Try #2:
 envVar = BatchAppTemplate.createDataType("Environment.Variable");  // ----------------  envVar.setKey("SampleKey1");
 envVar.setValue("SampleValue1");    execTask.addEnv(envVar);  ]]&gt; &lt;/script&gt;&lt;/target&gt;
Try #1, results in: file:c:/build.xml:253: ReferenceError: "org" is not defined. (&lt;ANT&gt;;
line 10) Try #2, results in: file:c:/build.xml:253: TypeError: Cannot convert null to an object.
(&lt;ANT&gt;; line 14) I can understand why neither try works. So, what is the proper
way to do this? What am I doing wrong?

_______________________________________________
Join Excite! - http://www.excite.com
The most personalized portal on the Web!

Mime
  • Unnamed multipart/alternative (inline, 7-Bit, 0 bytes)
View raw message