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 18:02:17 GMT

My apologies for the unreadable formatting of my last message. Here is what I intended to
send:
---

I'm trying to recreate the following in the build.xml using the <script> task and javascript:

<exec executable="${exe_location}" dir="${exe_dir}">
<env key="${env_var_key}" value="${env_var_value}"/>
<arg value="${arg1}"/>
<arg value="${arg2}"/>
</exec>

Here's what I tried to do:

<target name="testme">
<script language="javascript"> <![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 <env> child element of <exec> 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);

]]> </script>
</target>

Try #1, results in:

file:c:/build.xml:253: ReferenceError: "org" is not defined. (<ANT>; line 10)

Try #2, results in:

file:c:/build.xml:253: TypeError: Cannot convert null to an object. (<ANT>; 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!

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


Mime
View raw message