ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Richardson <eric.richard...@milagrosoft.com>
Subject Re: Strange java/fork behavior with xalan
Date Fri, 27 Jul 2001 01:19:16 GMT
Conor MacNeill wrote:
> 
> > From: Eric Richardson [mailto:eric.richardson@milagrosoft.com]
> >
> > BTW, it would be nice if embedding ant was considered as a design
> > criteria in the next major release. Ant seems to work very well if run
> > standalone or from a script but running from Java is tough at least as
> > far as I've tried so far(Although i'd certainly not be an expert on this
> > topic).
> 
> Eric, what are you finding tough. There are some issues currently for sure,
> but it can be done and I believe it has been done in products such as
> NetBeans. The best approach is usually to create your own Project object and
> manage it from within your app, much the same way as Main.java does now.

I tried running it with an exec from java. I didn't think to look at
Main.java to embed.

I'm taking a different approach which I think is better but still having
problems. I need to pass two different locations on the file system to
ant. I'm using -D with absolute paths. This is the last part of the
simple shell wrapper.

build_file="-buildfile ${doc_root}/src/example/build.xml"
d_opts="-Ddoc_root=${doc_root} -Djdocbook_home=${jdocbook_home}"
# run ant
${jdocbook_home}/jakarta-ant-1.3/bin/ant ${d_opts} ${build_file} "$@"

In the ant file I try to use 

  <!-- Incoming -D properties:  jdocbook_home, doc_root -->
  <property name="jdocbook.home" location="${jdocbook_home}"/>
  <property name="doc.root" location="${doc_root}"/>

These are absolute and correct but now I can't build path from these
such as 

  <!-- docbook xsl/dtd properties -->
  <property name="driver.root" location="${jdocbook.home}/drivers"/>
  <property name="xhtml.driver"
location="${driver.root}/xhtmldriver.xsl"/>
  <property name="fo.driver" location="${driver.root}/fodriver.xsl"/>

It seems to look at these and add the relative path to the front. Is the
problem the evaluate sequence so that ${xxx} gets evalated after and the
location rule "if it starts with / don't mess with it" doesn't get
followed?. 

I got style to work but only when my pieces were all in the same place.
>From my style command target.

  <target name="style" depends="prepare">
    <style basedir="${input.dir}" 
	   destdir="${output.dir}" 
	   extension=".html" 
	   style="${xhtml.driver}" >
      <include name="${input.file}"/>
    </style>
  </target>

Here is the bad output(*** my additions ***):

style:
    [style] Transforming into
/home/maxwell/jdocbook2/docroot/docs/example
    [style] Loading stylesheet
/home/maxwell/jdocbook2/docroot/src/example/home/maxwell/jdocbook2/drivers/xhtmldriver.xsl
*** local build path added ***
    [style] Failed to read stylesheet
/home/maxwell/jdocbook2/drivers/xhtmldriver.xsl
*** this is what I want ***

BUILD FAILED

/home/maxwell/jdocbook2/docroot/src/example/build.xml:86:
javax.xml.transform.TransformerConfigurationException: File
"file:/home/maxwell/jdocbook2/docroot/src/example/home/maxwell/jdocbook2/drivers/xhtmldriver.xsl"
not found.
*** same as first one ***
> 
> Let us know the details of the issues you are having and we can help more.
> 
> Conor

Two things I could use help with, the path thing above,

and how to get the classpath to the style task. I have this already in
my file which worked before when I called xalan with a java task.

  <path id="xalan.classpath">
    <fileset dir="${xalan.dir}/bin">
      <include name="xalan.jar"/>
      <include name="xerces.jar"/>
      <include name="bsf.jar"/>
    </fileset>
  </path>

Thanks,
Eric

Mime
View raw message