How to Build and Deploy our Web Application¶
The project has a
build.xml file, that is the task configuration file for Ant and that we use to build the application.
Make sure you edit the file
build.propertiesand change the property
tomcat.hometo match the tomcat in your system.
Add the Ant View window to Eclipse going to the menu
From the Ant View click the first button/icon Add Buildfiles and choose the
build.xmlinside your project
Depending from the option ‘Hide Internal Targets’ you will see several tasks. What we need are:
If build.properties is correct after you click the web task, Ant will start copying all the compiled java classes with all the rest of the files inside a new folder named ‘build’ under your project.
When Ant has finished the task execution, you will see a new folder
this folder contains the final web application that should be deployed to the server.
Always stop the Web Application Server (Tomcat) First!
To deploy the application use WinSCP and not other tools like Filezilla or any other ftp tools just W I N S C P.
Open WinSCP go to
Defaultas preset and click on
In the exclude files section add the following lines:
*/system_config_ko.properties */system_config_local.properties */struts.properties */log4j.properties
In the exclude directories add the following lines:
*/WEB-INF/python/cachedir */data/edms */old */pmis_html */.svn */cachedir */ckeditor-dev */src */.git
As a final touch uncheck
Calculate total sizefrom Common options in the Transfer settings window, we don’t need it and takes too long. Click OK and we finished setting the mask for synchonize our project.
IMPORTANT before deploying the web folder always check that the Transfer Settings at the top of the application says
Defaultas the selected mask.
On the left select the build/web folder on your computer
On the right select the project web folder on the server
Click the button
Remoteas Target Directory
Mirror Filesas Mode
Modification timeas Comparison criteria.
Preview changesunder Synchronize options.
And finally check the box
Use same options next timeso you don’t have to go through 7~10 again next time.
Click OK and a new window Synchronization checklist show up, check what files are going to be updated, deleted.
Check alland then OK, the application will do his job and its done.
You can start again the Web Application Server (Tomcat).
What is build-js task?¶
reducing requests per user so we should have more happy users and more happy servers.
If you execute this task you will find the final file inside the folder
Now take in consideration that if you execute the
web task you do NOT need to execute
web task will execute the
build-js task anyway.
build-js task only,
and make sure you copy this file inside the folder
ext/script inside the
web folder of the application on the server machine.
As a side note to make this task really useful make sure the system property
system.devmode is false.
Always change the
build.properties file with the correct Tomcat directory before running Ant tasks