You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Kyle Adams <ka...@gfs.com> on 2003/01/10 14:51:05 UTC

Spaces in the path, XSLT, and Java

I have a buildfile that's dynamically generates via XSLT.  Within that
buildfile, I make a java call; one of the args passed into that java
call (via <jvmarg>) contains the property ${user.home}.  On Windows
2000, that resolves to c:\Documents and Settings\<username>, which
causes the java call to fail.

>From the xsl template:

        <java classname="org.apache.tools.ant.Main" fork="yes"
failonerror="no" dir="${{env.DEV_DIR}}/{@basedir}">
            <xsl:choose>
                <xsl:when test="/workspace/@output = 'stdout'">
                    <arg line="-listener
org.apache.tools.ant.TextLogger"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:attribute name="output"><xsl:value-of
select="$logdir"/><xsl:text>/buildlog-</xsl:text><xsl:value-of
select="@name"/><xsl:text>.txt</xsl:text></xsl:attribute>
                </xsl:otherwise>
            </xsl:choose>
            <jvmarg line="-Dlogfile="{$logdir}/buildlog-{@name}.txt"/>
            <jvmarg line="-Dsnap.home=${{env.SNAP_HOME}}"/>
            <jvmarg line="-Ddev.dir=${{env.DEV_DIR}}"/>
            <jvmarg line="-Dtoken.dir=${{token.dir}}"/>
            <arg line="-listener org.apache.tools.ant.MailListener2"/>
            <arg line="-listener org.apache.tools.ant.XmlLogger
-DXmlLogger.file={$logdir}/buildlog-{@name}.xml"/>
            <arg line="-logger org.apache.tools.ant.NoBannerLogger"/>
            <arg line="-buildfile {$snap-file} -emacs snap"/>
            <classpath>
                <pathelement path="${{java.class.path}}"/>
            </classpath>
        </java>

The line of particular concern is:

            <jvmarg line="-Dlogfile="{$logdir}/buildlog-{@name}.txt"/>
 
$logdir is an XSL variable that (by default) contains the ant variable
${user.home}.  The error message I receive is:

     [java] java.lang.NoClassDefFoundError: and
     [java] Exception in thread "main"
     [java] Java Result: 1

Any solution needs to work in XSL, Ant, and be a valid java call.



Kyle Adams
Java Developer
Gordon Food Service

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Spaces in the path, XSLT, and Java

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 10 Jan 2003, Kyle Adams <ka...@gfs.com> wrote:

> I have a buildfile that's dynamically generates via XSLT.  Within
> that buildfile, I make a java call; one of the args passed into that
> java call (via <jvmarg>) contains the property ${user.home}.

Don't use the line attribute, use value and Ant will take care of the
spaces.

Stefan

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>