• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

war task gives warnings

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My build.xml contains the following war task.
<war warfile="${basedir}/webproj.war"
webxml="${webInfDir}web.xml"
basedir="${webAppDir}"
manifest="${webAppDir}${file.separator}META-INF${file.separator}MANIFEST.MF"
/>
When it runs, I get the following warnings:
Warning: selected war files include a META-INF/MANIFEST.MF which will be ignored (please use manifest attribute to war task)
Warning: selected war files include a WEB-INF/web.xml which will be ignored (please use webxml attribute to war task)
I am using both the webxml and manifest attributes. Can anyone explain these warnings? What do they really mean? Should I be doing it differently?
Thanks,
Mark
 
Ranch Hand
Posts: 170
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the warfile attribute is old and that's why Ant thinks you have web.xml and manifest not in attribute (they are in your existing war file).
From Ant manual:
"warfile" Deprecated name of the file to create, use destfile instead.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are getting this error because 'manifest.mf' and 'web.xml' are already included in '${webAppDir}'
Try to exclude both files e.g. change your '<war' target like this:

Ren´┐Ż
[ March 10, 2004: Message edited by: Rene Larsen ]
 
Mark Binau
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rene. That got it to work without the warning.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just for anyone that Googles this and still can't fix it - it's important to do

<exclude name="**/web.xml"/>

rather than

<exclude name="${warclasses}/WEB-INF/web.xml"/>

Cheers
 
Saloon Keeper
Posts: 27858
196
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
Actually, that's a pet peeve. Since I keep the invariant parts of my webapp in a mirror-image of the final WAR, my web.xml WILL be in the WAR input and I'll get that message. I wish they'd give me an "I know, shut up!" option.

I tried an out-of-line web.xml and didn't like it. Although if I were using xdoclet to generate one on the fly, that would be different.
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nice I was having this warning for sometime, and this is a good fix.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is why I still love the java community. I googled this problem and found the perfect solution thanks to you guys.

Thanks so much everyone!
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just as an aside, if you already have a directory set up as a mirror image of the contents of the war file, then you don't need to use the "war" task at all. The regular zip task will create a fully-compliant war file much more simply, and without complaining:



"war"? huh. What is it good for?
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The war task is really designed to assemble a war file when you don't already have a directory that represents the contents of your war.

If you already have a directory that contains the contents of your exploded war file, with a WEB-INF and everything, the jar task is more appropriate.

If, however, you have classes in one place, and libraries in another, and a manifest somewhere else, and none of it is organized anything like a war file, the war task will put them all in the right place on-the-fly inside the war file without disrupting where they are in their original locations.
 
reply
    Bookmark Topic Watch Topic
  • New Topic