Problem with build.xml and build definition
I have a web application in eclipse and when I export a file into a. war, the file is 14mb in size.
When I generate the war file by build.xml with a buid definition, the file is 25mb in size.
The war generated by build.xml I can not deploy. I don't know why.
What am I doing wrong? help me please!
2 answers
I solved the problem. The ANT war tag was duplicating the jar files of WEB-INF/LIB. Because of this the war file was 25 MB. The solution was to modify the war tag as follow:
<war destfile="build/dist/SITRA.war" webxml="WebContent/WEB-INF/web.xml" manifest="WebContent/META-INF/MANIFEST.MF">
<fileset dir="WebContent">
<include name="**/**"/>
<exclude name="WEB-INF/lib/*.*"/>
</fileset>
<lib dir="WebContent/WEB-INF/lib/"/>
<classes dir="build/classes"/>
</war>
I found the solution in this page:
http://gradle.1045684.n5.nabble.com/War-packed-with-duplicated-jars-td4624905.html
I don't think it is RTC related. Anyway:
exporting into war in Eclipse and building war file using ant are really different operations. Ho did you exactly created build.xml file? Did you write it manually or used any tool for that? If the file size differs, I would say that there are some libraries not exported into war. Please open both war files in zip tool (e.g. 7zip) and check what are the differences there. Then correct your build.xml file to include all files you need.
BTW what do you mean that it cannot deploy it? Do you have any error message? Please elaborate.
Comments
Krzystof,
What I'm trying to do is use the feature to generate automatic build of RTC . What I did was:
I created a web application in eclipse and generated the build.xml by Eclipse itself (I selected the project and exported it to Ant build file. server (Tomcat), the application does not run, just opens a blank page in the browser .
But when I export my application in Eclipse to a file .war (without using the build.xml), Eclipse generates a file with only 14 Mb. When I deploy this file on the application server, the application runs correctly .
When I extract the war files (generated by Eclipse and generated by build.xml), they have exactly the same files and directories.
Here is the tags i am using to compile and generate the war file:
<javac debug="true" debuglevel="${debuglevel}" destdir="build/classes" includeAntRuntime="false" source="${source}" target="${target}" encoding="utf-8">
<src path="fw"/>
<src path="src"/>
<classpath refid="SITRA.classpath"/>
</javac>
<war destfile="build/dist/SITRA.war" webxml="WebContent/WEB-INF/web.xml" manifest="WebContent/META-INF/MANIFEST.MF">
<fileset dir="WebContent">
<include name="*/"/>
</fileset>
<lib dir="WebContent/WEB-INF/lib/" />
<classes dir="build/classes"/>
</war>
Hi Luiz,
If they have exactly the same files and directories, then it must be an issue with file sizes. Which files differ in size?
Also what error message do you have during deployment?