You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Salvador I. Ducros" <sd...@hywy.com> on 2001/09/06 23:38:37 UTC

Java task in Linux

Part of a build target in my build.xml file tries to compile
a group of JSP sources into Java sources using the JSP compiler
in Tomcat. The relevant task looks like this:

    <java fork="yes" dir="projects/template/gui/jsp"
classname="org.apache.jasper.JspC">
        <classpath refid="jspcp" />
        <arg line="-uriroot . *.jsp" />
        <jvmarg line="-Dtomcat.home=${basedir}/tomcat" />
    </java>

The 'jspcp' refid in the 'classpath' is defined at the top of my
build.xml file with a <path> ... </path> statement. This works perfectly
on Windows 2000 but breaks on Linux. The output on linux returned is:

    Buildfile: build.xml

    init:

    build:
         [java] 2001-09-06 09:07:54 - The file argument '*.jsp' does not
exist

    BUILD FAILED

I can run the equivalent Java command line from the shell and it will
compile
the JSPs successfully.

    e.g. java -Dtomcat.home=$TOMCAT_HOME org.apache.jasper.JspC -uriroot
*.jsp

         N.B. With TOMCAT_HOME and CLASSPATH set appropriately of course and
              executed from the directory containing the JSP sources.

Anyone ever have similar problems? I'm left with two suspicions. One is
that the JVM is not being forked from the directory specified by the 'dir'
attribute in the 'java' task (projects/template/gui/jsp in this case).
My second suspicion was that the wildcard '*.jsp' was not being expanded.
Any ideas? Like I said, this works on Windows 2000.


Salvador Ducros
sducros@hywy.com


Re: Java task in Linux

Posted by Diane Holt <ho...@yahoo.com>.
The "*.jsp" is your problem. On Win* systems, every command deals with
wildcard expansion itself, which is why this works for you on your Win2K.
On Unix, wildcard expansion is done by the shell before the command is
run. Ant doesn't go through the shell, so on your Linux system your 'java'
command is being handed a literal "*.jsp" instead of all the .jsp
filenames. I think you'll probably want to look at the <apply> task, which
uses a <fileset>, and also has the added advantage of only handing off
source-files that are newer than their targets.

Diane

--- "Salvador I. Ducros" <sd...@hywy.com> wrote:
> Part of a build target in my build.xml file tries to compile
> a group of JSP sources into Java sources using the JSP compiler
> in Tomcat. The relevant task looks like this:
> 
>     <java fork="yes" dir="projects/template/gui/jsp"
> classname="org.apache.jasper.JspC">
>         <classpath refid="jspcp" />
>         <arg line="-uriroot . *.jsp" />
>         <jvmarg line="-Dtomcat.home=${basedir}/tomcat" />
>     </java>
> 
> The 'jspcp' refid in the 'classpath' is defined at the top of my
> build.xml file with a <path> ... </path> statement. This works perfectly
> on Windows 2000 but breaks on Linux. The output on linux returned is:
> 
>     Buildfile: build.xml
> 
>     init:
> 
>     build:
>          [java] 2001-09-06 09:07:54 - The file argument '*.jsp' does not
> exist
> 
>     BUILD FAILED
> 
> I can run the equivalent Java command line from the shell and it will
> compile
> the JSPs successfully.
> 
>     e.g. java -Dtomcat.home=$TOMCAT_HOME org.apache.jasper.JspC -uriroot
> *.jsp
> 
>          N.B. With TOMCAT_HOME and CLASSPATH set appropriately of course
> and
>               executed from the directory containing the JSP sources.
> 
> Anyone ever have similar problems? I'm left with two suspicions. One is
> that the JVM is not being forked from the directory specified by the
> 'dir'
> attribute in the 'java' task (projects/template/gui/jsp in this case).
> My second suspicion was that the wildcard '*.jsp' was not being
> expanded.
> Any ideas? Like I said, this works on Windows 2000.
> 
> 
> Salvador Ducros
> sducros@hywy.com
> 


=====
(holtdl@yahoo.com)



__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com