ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim White <...@pagesmiths.com>
Subject Re: converting a file reference to a URL
Date Mon, 17 Sep 2001 01:43:28 GMT
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


Mime
View raw message