You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Lothar Krenzien <lk...@web.de> on 2005/11/08 18:21:39 UTC

problems creating war file

Hi there,

I'm trying to create a war file using the Ant war-task. The creted file seems to be ok but all the files under WEB-INF/classes and WEB-INF/lib exists twice or even 3-times (with the same name in the same dir). Of course I can skip the duplicate files but it confuse me ;)

My app looks like (for testing reasons I'm using a temporay directory) :

C:\Temp\ant-test\application
|
| ----src
|       |
|       -- com ....
|
| ----web
|       |
|       ---- css / js / jsp / Meta-INF / Web-INF ...
|
| ----deployment (temporary working dir)

The Ant script copies all files under src/com and web to the deployment dir, compiles the classes (put it under the Web-INF/classes) and then building a war-archive using the Ant war-task.

Here's my Ant script:

<war destfile="${outDir}/conergy.war" webxml="${outDir}/web/conergy/WEB-INF/web.xml">
<metainf dir="${outDir}/web/webapp/META-INF"/>
<webinf dir="${outDir}/web/webapp/WEB-INF" />
<lib dir="${outDir}/web/webapp/WEB-INF/lib"/>
<classes dir="${outDir}/web/webapp/WEB-INF/classes"/>

<zipfileset dir="${outDir}/web/webapp/css" prefix="css"/>
<zipfileset dir="${outDir}/web/webapp/js" prefix="js"/>
<zipfileset dir="${outDir}/web/webapp/jsp" prefix="jsp"/>
<zipfileset dir="${outDir}/web/webapp/image" prefix="image"/>
</war>

The created war-file looks like :
<root>
|
| -- css
|
| -- js
|
| -- jsp
|
| -- Web-INF
| |
| | -- classes
|
|
| -- Meta-INF

and so on.

Thanks, Lothar


______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: problems creating war file

Posted by Clifton Craig <cc...@gbg.com>.
It looks like you got some redundancy in your war task there. You're grabbing 
everything under ${outDir}/web/webapp/WEB-INF with the <webinf/> subelement 
and then you're going out and specifically grabbing the lib and classes 
folders under your ${outDir}/web/webapp/WEB-INF folder with the lib and 
classes subelements respectively. If you want to get rid of the duplicates 
remove either the <webinf/> sub element or both the <lib/> and <classes/> sub 
elements. Of course you can result to what Andrew says in his reply as well.
-- 
Clifton C. Craig, Software Engineer
ccraig@gbg.com
On Tuesday 08 November 2005 12:21 pm, Lothar Krenzien wrote:
> Hi there,
>
> I'm trying to create a war file using the Ant war-task. The creted file
> seems to be ok but all the files under WEB-INF/classes and WEB-INF/lib
> exists twice or even 3-times (with the same name in the same dir). Of
> course I can skip the duplicate files but it confuse me ;)
>
> My app looks like (for testing reasons I'm using a temporay directory) :
>
> C:\Temp\ant-test\application
>
> | ----src
> |
> |       -- com ....
> |
> | ----web
> |
> |       ---- css / js / jsp / Meta-INF / Web-INF ...
> |
> | ----deployment (temporary working dir)
>
> The Ant script copies all files under src/com and web to the deployment
> dir, compiles the classes (put it under the Web-INF/classes) and then
> building a war-archive using the Ant war-task.
>
> Here's my Ant script:
>
> <war destfile="${outDir}/conergy.war"
> webxml="${outDir}/web/conergy/WEB-INF/web.xml"> <metainf
> dir="${outDir}/web/webapp/META-INF"/>
> <webinf dir="${outDir}/web/webapp/WEB-INF" />
> <lib dir="${outDir}/web/webapp/WEB-INF/lib"/>
> <classes dir="${outDir}/web/webapp/WEB-INF/classes"/>
>
> <zipfileset dir="${outDir}/web/webapp/css" prefix="css"/>
> <zipfileset dir="${outDir}/web/webapp/js" prefix="js"/>
> <zipfileset dir="${outDir}/web/webapp/jsp" prefix="jsp"/>
> <zipfileset dir="${outDir}/web/webapp/image" prefix="image"/>
> </war>
>
> The created war-file looks like :
> <root>
>
> | -- css
> |
> | -- js
> |
> | -- jsp
> |
> | -- Web-INF
> |
> | | -- classes
> |
> | -- Meta-INF
>
> and so on.
>
> Thanks, Lothar
>
>
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: problems creating war file

Posted by Andrew Goktepe <an...@gmail.com>.
Use the 'duplicate' attribute of the <war> task to prevent this.
http://ant.apache.org/manual/CoreTasks/war.html
 If you set duplicate="fail" then the task will fail if it finds duplicates.
You can use this to fix any unnecessary redundancy in the source paths. If
the duplicates in the source paths are needed, then look at the other
possible values for 'duplicate', such as "preserve".
 -Andrew
 On 11/8/05, Lothar Krenzien <lk...@web.de> wrote:
>
>
> Hi there,
>
> I'm trying to create a war file using the Ant war-task. The creted file
> seems to be ok but all the files under WEB-INF/classes and WEB-INF/lib
> exists twice or even 3-times (with the same name in the same dir). Of course
> I can skip the duplicate files but it confuse me ;)
>
> My app looks like (for testing reasons I'm using a temporay directory) :
>
> C:\Temp\ant-test\application
> |
> | ----src
> | |
> | -- com ....
> |
> | ----web
> | |
> | ---- css / js / jsp / Meta-INF / Web-INF ...
> |
> | ----deployment (temporary working dir)
>
> The Ant script copies all files under src/com and web to the deployment
> dir, compiles the classes (put it under the Web-INF/classes) and then
> building a war-archive using the Ant war-task.
>
> Here's my Ant script:
>
> <war destfile="${outDir}/conergy.war"
> webxml="${outDir}/web/conergy/WEB-INF/web.xml">
> <metainf dir="${outDir}/web/webapp/META-INF"/>
> <webinf dir="${outDir}/web/webapp/WEB-INF" />
> <lib dir="${outDir}/web/webapp/WEB-INF/lib"/>
> <classes dir="${outDir}/web/webapp/WEB-INF/classes"/>
>
> <zipfileset dir="${outDir}/web/webapp/css" prefix="css"/>
> <zipfileset dir="${outDir}/web/webapp/js" prefix="js"/>
> <zipfileset dir="${outDir}/web/webapp/jsp" prefix="jsp"/>
> <zipfileset dir="${outDir}/web/webapp/image" prefix="image"/>
> </war>
>
> The created war-file looks like :
> <root>
> |
> | -- css
> |
> | -- js
> |
> | -- jsp
> |
> | -- Web-INF
> | |
> | | -- classes
> |
> |
> | -- Meta-INF
>
> and so on.
>
> Thanks, Lothar
>
>
> ______________________________________________________________
> Verschicken Sie romantische, coole und witzige Bilder per SMS!
> Jetzt bei WEB.DE <http://WEB.DE> FreeMail: http://f.web.de/?mc=021193
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>