ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rod Macpherson <maild...@pacbell.net>
Subject Re: Howto search for file then call exec on each on them
Date Sun, 02 Mar 2003 06:49:49 GMT
Philip,

The problems that come up with ant almost always relate to the high-level
tasks. I have one right now. Using the javac task (pretty fundamental you
would think) there is a new attribute to specify 1.3 or 1.4 as the target.
That's fine (until it changes again) but there is no switch to enable
asserts and I suspect people are using 1.4 not knowing that their asserts
are not even enabled: must be explicitly enabled. I am hoping I am just
missing something in that regard. Other high level tasks have big problems.
I immediately ditched the EAR and WAR tasks and instead used the simple jar
task. Now it looks like javac will have to be scratched as a useful task and
I will just launch a java task that compiles. You have the same problem with
compiling JSP pages only much worse. That should never have been added as a
task unless they could make it work consistently, IMO. I hope they get rid
of the mountain of crap (like the jspc task) that has been piled on to this
otherwise great tool!

To compile your JSPs you will need to supply a path, for example with JBoss:

  <path id="jspc-classpath">
      <pathelement path="${my.lib}/foo.jar"/>
      <pathelement path="${j2ee.lib}/j2ee.jar"/>
      <pathelement
path="${jboss.deploy}/jbossweb.sar/org.apache.jasper.jar"/>
  </path>

Next you can use the java task to fork a JspC call and you need to know the
target location of compiled JSPs used by your appserver. You also need to
know the package name but the latest jasper's -p option applies to all of
the JSPs and does not create a package hierarchy based on the JSP directory,
relative to the base package, like it used to do. At least this checks the
syntax of your pages by compiling them but it does not create a useable
package hierarchy.

  <target name="jspc">
      <java fork="true" classname="org.apache.jasper.JspC"
classpathref="jspc-classpath">
          <arg line="-p this.is.now.broken -dd ${tmp.jspc} -webapp
/jboss/server/default/deploy/${war}"/>
      </java>
      <javac srcdir="${tmp.jspc}" destdir="${tmp.jspc}"
classpathref="jspc-classpath"/>
  </target>

----- Original Message -----
From: "Philip Lo" <philiplo@patimas.com>
To: <user@ant.apache.org>
Sent: Saturday, March 01, 2003 7:22 PM
Subject: Howto search for file then call exec on each on them


> I'm new to Ant. How can I search for a set of files within a directory
> with an extension .jsp and then use the <exec> task to act on each of
> the file. Basically, I want to search for all JSP files within my WAR
> directory then call the JSP compiler and supply the path of JSP file as
> 1st argument. Thanks in advance.
>
> regards,
> Philip
>


Mime
View raw message