You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by David Jordan <Da...@objectidentity.com> on 2001/09/17 02:15:57 UTC
converting a file reference to a URL
1.
I have a file/directory in my build directory (or subdirectory)
and I would like to convert this to a valid URL.
I am running on Windows.
Whenever you use a directory in Ant, it converts it to the
underlying OS representation (which uses backslash).
But I want to execute a Java program that expects a URL,
which uses forward slashes between directory names.
How do you do this in ant?
2.
Is it possible to kick off several tasks or <java> commands
in parallel? Just listing two <java> in a target runs them serially.
David Jordan
mailto:david.jordan@objectidentity.com
Object Identity, Inc.
www.objectidentity.com
Re: converting a file reference to a URL
Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
David Jordan wrote:
> 1.
> I have a file/directory in my build directory (or subdirectory)
> and I would like to convert this to a valid URL.
> I am running on Windows.
> Whenever you use a directory in Ant, it converts it to the
> underlying OS representation (which uses backslash).
> But I want to execute a Java program that expects a URL,
> which uses forward slashes between directory names.
> How do you do this in ant?
>
You may be able to use the pathconvert task provided in Ant 1.4
http://jakarta.apache.org/ant/manual/CoreTasks/pathconvert.html
Conor
Re: converting a file reference to a URL
Posted by Erik Hatcher <ja...@ehatchersolutions.com>.
As for (1) I don't know of a way to do this, except using the <script> task.
(2) - check out the <parallel> task in Ant 1.4, it'll do what you are
asking.
Erik
----- Original Message -----
From: "David Jordan" <Da...@objectidentity.com>
To: <an...@jakarta.apache.org>
Sent: Sunday, September 16, 2001 5:15 PM
Subject: converting a file reference to a URL
>
> 1.
> I have a file/directory in my build directory (or subdirectory)
> and I would like to convert this to a valid URL.
> I am running on Windows.
> Whenever you use a directory in Ant, it converts it to the
> underlying OS representation (which uses backslash).
> But I want to execute a Java program that expects a URL,
> which uses forward slashes between directory names.
> How do you do this in ant?
>
> 2.
> Is it possible to kick off several tasks or <java> commands
> in parallel? Just listing two <java> in a target runs them serially.
>
>
> David Jordan
> mailto:david.jordan@objectidentity.com
> Object Identity, Inc.
> www.objectidentity.com
>
>
>
>
Re: converting a file reference to a URL
Posted by Jim White <ji...@pagesmiths.com>.
At 08:15 PM 9/16/2001 -0400, David Jordan wrote:
>1.
>I have a file/directory in my build directory (or subdirectory)
>and I would like to convert this to a valid URL.
>I am running on Windows.
>Whenever you use a directory in Ant, it converts it to the
>underlying OS representation (which uses backslash).
>But I want to execute a Java program that expects a URL,
>which uses forward slashes between directory names.
>How do you do this in ant?
I've been using JavaScript (Rhino) to do that:
<script language="javascript">
var v = xdrive_setup.getProperty("dist");
// Change '\' in path to '/' in case this is Windows.
v = v.split("\\").join("/");
xdrive_setup.setProperty("server-windows-url", "file:/" + v +
"/%SYSTEM_NAME%");
xdrive_setup.setProperty("server-unix-url", "file://" + v +
"/$SYSTEM_NAME");
</script>
Note that one of the cool things you can do is get a path from it's id:
<script language="javascript">
// Get the list of path elements as an array.
var jarlist =
xdrive_setup.getReferences().get("ejb-jars.classpath").list();
// Join the array strings with a comma seperator and set the
property.
var jars = jarlist.join(',');
// Change '\' in path to '/' in case this is Windows.
var jars = jars.split("\\").join("/")
xdrive_setup.setProperty("weblogic.ejb.deploy", jars);
</script>
>2.
>Is it possible to kick off several tasks or <java> commands
>in parallel? Just listing two <java> in a target runs them serially.
That is available in Ant 1.4 as the Parallel task
jim
----------------------------------------------------------------
James P. White Netscape DevEdge Champion for IFC
IFC Exchange * Insanely great Java * http://www.ifcx.org
jim@pagesmiths.com Pagesmiths' home is http://www.pagesmiths.com