I have an Ant task for WAR'ing up my web project. Here is the WAR task
The strange thing I just noticed is that if I look at the contents of the WAR file all the JAR files from my lib.dir are doubled. So I have 2 of every JAR file in the WAR file. Also, the j2ee.jar file is not being excluded. These issues don't cause problems when I deploy the WAR as Tomcat ignors the j2ee.jar file and as the contens are being extracted the JAR files just overright each other, but it is causing my WAR file to be twice as large in size. Plus it's just strange behavior.
I am running Ant 1.6.2 but it is also doing it withing IDEA which is running Ant version 1.5 or something of that nature. Anyone have any ideas?
I don't know what's the problem with that script. But, I think this will work -------------------------------------------------------------- <target name="build" depends="compile" > <jar jarfile="something.war" basedir="${buildpath}"/> </target>
<target name="compile" depends="init" > compile all files to ${buildpath}\WEB-INF\classes copy all .xml .tld files to ${buildpath}\WEB-INF copy all .jar files to ${buildpath}\WEB-INF\lib copy all .jsp .htm files to ${buildpath} </target>
<target name="init" > create all directory structures </target> ---------------------------------------------------------------
Carol Enderlin
drifter
Ranch Hand
Joined: Oct 10, 2000
Posts: 1348
posted
0
Is your webinf task grabbing the jars? I don't know the structure of your source directories.
I build my web projects as exploded WARs. Tomcat (among others) can use the exploded WAR for testing, then when I'm happy with it, I WAR up the exploded WAR. Like so:
The main benefits are that it saves a small amount of time when doing trivial experiments such as adjusting styles and that it makes the WAR function very straightforward.
The main downside is that I have to remember once I'm happy with my little tweaks to bounce them back to the source tree before I do the WAR build or watch them all get blown away (and it serves me right!).
And, of course, if you don't run a clean before building the WAR, you could get a mishmash of stuff some of which didn't come from the source tree. Fortunately I've got myself trained to always do "ant clean war".
Customer surveys are for companies who didn't pay proper attention to begin with.
Amber Vaidya
Ranch Hand
Joined: Oct 14, 2003
Posts: 42
posted
0
I think Carol is right .. A typical directory structure would be
jsp WEB-INF lib classes web.xml
If this is similar to your directory structure then the jars are getting added twice because you have <lib> and <webinf> defined in your build.xml.