• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Ant war task and JSP tag files

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm new to Ant and JSP, and have hit a problem; I've been working through Head First Servlets and JSP (great book), and have got to the part where you create custom tags using tag files. I want my Ant build.xml to put them into WEB-APPS/tags, and can't see how.
At the moment my War task reads:
<target name="dist" depends="build" description="blah">
<!-- make the war file -->
<war destfile="${warfile}" webxml="${etc}/web.xml">
<classes dir="${build}"/>
<fileset dir="${jsp}" includes="*.jsp" />
<!-- how do I get *.tag files into /WEB-INF/tags ? -->
<lib dir="${lib}" includes="*.jar, *.tld" />
</war>
...
</target>

Thanks
Charlie Howard
 
Sheriff
Posts: 67664
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Ant forum.
 
Saloon Keeper
Posts: 26020
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Someone asked a similar question not long ago, but I'll expound on my answer then.

My experience is that attempting to build WARs up from 87 different places is frustrating and error-prone. These days I have a webapp subdirectory in the project that contains my static content. The build process copies that entire subdirectory (specifically the JSPs, stylesheets, JavaScript, TLDs, WEB-INF - including external classes and library JARs etc.) into the build webapp directory, which is also (build/webapp/WEB-INF/classes) the target for the webapp class compiles and XDoclet output (Struts config build, for example).

My build/webapp directory thus contains the entire WAR, exploded, which Tomcat and other servers can use directly for testing purposes and that I can then WAR up in a single operation when I'm ready to make the app deployable. The only annoyance is that to use an exploded WAR, I need to include a web.xml file in the build/webapp/WEB-INF directory which makes the Ant WAR task whine since the Ant people think that the web.xml should only come from an external source. It's a small price to pay.
 
Charles Howard
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Tim. A little over my head though. Are you saying my development folders should mirror the Tomcat webapp folders exactly? If so, why should I bother with a JAR file at all?
And if I do things your way, I would still like to know the answer to my question
Thanks anyway
Charlie Howard
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried using the nested element webinf?

From the ant manual on the war task

webinf
The nested webinf element specifies a FileSet. All files included in this fileset will end up in the WEB-INF directory of the war file. If this fileset includes a file named web.xml, the file is ignored and you will get a warning.


I searched my tools directory for an example to include, here's a clip from a jakarta taglib build.xml.


[ January 27, 2005: Message edited by: Carol Enderlin ]
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic