Running ANT on Linux

View: New views
5 Messages — Rating Filter:   Alert me  

Running ANT on Linux

by bgolman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everyone!

I need your help on running the ant task on Linux box. It might sound simple (and so it was for me), however, things turned out to be rather ugly. Any kind of help is appreciated. Now, here's what I'm trying to do:

Suppose I have a build.xml script, which includes a following task:

<xslt basedir="..."
destdir="..."
includes="*.*"
extension=".xml
style="ContentCleanup.xsl">

Basically, what it supposed to is to grab all the XML files from the base directory, run it through the aforementioned XSL file and output the results to the destination directory. Short and simple. However, there are thousands of these files to process and to get this done quickly I have to set the ANT_OPTS to something like this:
set ANT_OPTS=-Xmx1024m

That's on Windows and it works fine and very fast, however, after moving all my code to Linux box AND setting ANT_OPTS (export set ANT_OPTS=-Xmx1024m), the process runs extremely slow, as if ANT_OPTS have been ignored completely. Running "top" command, I noticed the following:

VIRT RES SHR %CPU %MEM
114m 65m 16m 101 2.6

It appears that one of those items (I think RES) should be increased to run the process faster, but how? And why ANT_OPTS do not work for this XSLT task? Just for comparison: my build script also calls a java process of my own, using task and I'm passing the memory usage info in these arguments:
<jvmarg value="-Xms1024M">
<jvmarg value="-Xmx1024M">

This java task works fine on Linux and RES shows exactly what I've excepted: 1024m. So, why not with the XSLT task?

I hope it doesn't sound confusing and I hope there's a rational explanation to this. I'm very new to Linux, especially using ant, and any help would be appreciated.

Please, throw any advises, because, frankly, I'm running out of ideas!

Re: Running ANT on Linux

by Dave Pawson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 24/04/2008, bgolman <b_golman@...> wrote:

>
>  Hello everyone!
>
>  I need your help on running the ant task on Linux box. It might sound simple
>  (and so it was for me), however, things turned out to be rather ugly. Any
>  kind of help is appreciated. Now, here's what I'm trying to do:
>
>  Suppose I have a build.xml script, which includes a following task:
>
>  <xslt basedir="..."
>  destdir="..."
>  includes="*.*"
>  extension=".xml
>  style="ContentCleanup.xsl">
>
>  Basically, what it supposed to is to grab all the XML files from the base
>  directory, run it through the aforementioned XSL file and output the results
>  to the destination directory.

That isn't valid with XSLT engines according to the W3C rec. Needs an engine
that supports it. It is viable with Saxon, maybe with Xalan I don't know.
Slow transforms could be due to you running with the default installed
java rather than Sun java, I found that slow.

Another option would be to write an XML file which lists the files to
be transformed, then use the document() xpath call to process them all.

HTH



--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

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


Re: Running ANT on Linux

by Robert Koberg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, 2008-04-24 at 19:48 +0100, Dave Pawson wrote:

> On 24/04/2008, bgolman <b_golman@...> wrote:
> >
> >  Hello everyone!
> >
> >  I need your help on running the ant task on Linux box. It might sound simple
> >  (and so it was for me), however, things turned out to be rather ugly. Any
> >  kind of help is appreciated. Now, here's what I'm trying to do:
> >
> >  Suppose I have a build.xml script, which includes a following task:
> >
> >  <xslt basedir="..."
> >  destdir="..."
> >  includes="*.*"
> >  extension=".xml
> >  style="ContentCleanup.xsl">
> >
> >  Basically, what it supposed to is to grab all the XML files from the base
> >  directory, run it through the aforementioned XSL file and output the results
> >  to the destination directory.
>
> That isn't valid with XSLT engines according to the W3C rec. Needs an engine
> that supports it. It is viable with Saxon, maybe with Xalan I don't know.

Not really sure what you mean by this. Of course it will work using ant.

Don't know why things are running slower on linux. I have always found
it to be much faster (assuming same hardware).

> Slow transforms could be due to you running with the default installed
> java rather than Sun java, I found that slow.
>
> Another option would be to write an XML file which lists the files to
> be transformed, then use the document() xpath call to process them all.
>
> HTH
>
>
>


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


Re: Running ANT on Linux

by foamdino :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
>  That's on Windows and it works fine and very fast, however, after moving all
>  my code to Linux box AND setting ANT_OPTS (export set ANT_OPTS=-Xmx1024m),
>  the process runs extremely slow, as if ANT_OPTS have been ignored
>  completely. Running "top" command, I noticed the following:

Run it again on windows using ant -debug to show the exact
tasks/config that is loaded,  run again on linux with ant -debug and
see if there is a difference.

My gut feeling is a Java version difference - *if* you're using a
stock linux, there's a good chance you will be running Java 1.4 (GCJ
or similar).  Sun Java 5/6 have a better XSL processing engine (Xalan
instead of crimson IIRC).  I think it was copied in wholesale from the
apache repos into javax.xml.org.apache.xalan in JDK1.5

See what the debug output says and maybe we can diagnose your problem

Kev

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


Re: Running ANT on Linux

by Dave Pawson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 24/04/2008, Robert Koberg <rob@...> wrote:

>  >
>  > That isn't valid with XSLT engines according to the W3C rec. Needs an engine
>  > that supports it. It is viable with Saxon, maybe with Xalan I don't know.
>
>
> Not really sure what you mean by this. Of course it will work using ant.

Input to an XSLT transform is supposed to be an (singular) xml instance,
not a directory. I know Saxon supports directory in, directory out.
I'm less sure if Xalan.
http://xml.apache.org/xalan-j/commandline.html shows no such extension
or option.

And yes, of course ant runs xslt (on single instances) :-)

regards



--
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

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