ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckn...@onebox.com
Subject Command line arguments with <java> task.
Date Tue, 08 Aug 2006 15:06:22 GMT
Last week I had a problem when installing ANT, a build file, and some supporting files on three
computers at my workplace. On two of the three computers I was not able to force the <xslt>
task to use the XSLT transformer I choose. At least that appeared to be the problem because
the error messages sent to the console suggested that the XSLT processor being used didn't
understand some XSLT 2.0 functions in the stylesheet.

So far that problem is still unresolved. Since a serious approach to troubleshooting the problem
would require that I have exclusive access to the workstations in question for an extended
period, thus denying the regular users the opportunity to carry out their normal work.


I got heavily involved in another task, but now I'm back to finding a "Plan B" for this matter.
It occurred to me that I could use the <java> task and call the XSLT processor directly.
So I looked at the ANT manual concerning the <java> task where I found this:

Examples
  <arg value="-l -a"/>

is a single command-line argument containing a space character.

  <arg line="-l -a"/>

represents two separate command-line arguments.

To my eye, these appear to be indentical. Which one is wrong?

The test case <java> task in my build file looks like this:

<target name="gen-properties" depends="init">
  <java classname="net.sf.saxon.Transform" fork="true">
    <classpath>
      <pathelement location="${env.SAXON_HOME}/saxon8.jar" />
    </classpath>
    <arg value="-o ${env.SARS_REPORTS_HOME}\lib\temp\pbd.xml" />
    <arg value="${env.SARS_REPORTS_HOME}/lib/federal-holidays.xml" />
    <arg value="${env.SARS_REPORTS_HOME}/lib/previous-bus-day.xslt" />
    <arg value="dow=${day.of.week}" />
    <arg value="span=${span}" />
    <arg value="current-date=${current.date}" />
  </java>
</target>

The problem I'm now having involves the first <arg> element. When I run the transformer
from the command line, passing in the same values for the arguments as shown above, the transformation
works as expected. Of course I susbstitute literal strings for the ANT properties in the last
three arguments.

When I run the target above instead, I get an error message from the Java class via ANT:
[java] Unknown option -o h:\sars-reports\lib\temp\pbd.xml

If I omit the first <arg> element, the task executes successfully, outputting the transformation
to the console window.

I suspect it has something to do with the warning in the ANT manual that I quoted earlier,
but as you can see, I find that section of the manual to be incomprehensible.

Please help if you can. Thanks.

-- 
Charles Knell
cknell@onebox.com - email

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


Mime
View raw message