Sunday, June 13, 2010

Better WTP dynamic project with FileSync

I have been working with eclipse WTP for quite some time for now. But all the time i have been working with small projects implementing some POC's etc. But recently i was confronted with the task of doing the same for a BIG project with some thousands of various types of resources including scripts, jsps, images, xmls, htmls, css and others. The source base is also having thousands of classes. After successfully configuring the WTP project for this new Big boy. As soon as i started the wtp server in eclipse, The Server immediately started the process of publishing the entire project to the deployment folder! It took good 5 minutes to copy the entire structure on my average desktop!.  Okay! i thought and once the server started i placed a set of break points and changed a single line of code and hit the save, in just 2 seconds or so again the process of publishing the entire project started!!! And after that my eclipse started dragging with the load of extra memory.

So the server is publishing the entire project structure with out simply publishing the resources that were changed! and that too everytime!! This is not fair! the WTP should be copying only the differentials rather than the entire project once we change any thing in the project. If this is a small project it might not have taken time at all, but being a Big project it is taking a lot of time :(

So we need to have a intelligent mechanism of copying only the differentials, stop the server from automatically publishing when ever there is a change to the project. And finally we need to manually sync the changes to the deployment folder and start the server for further debugging.

So i after googling around, i found the FileSync plugin which will do a sync of a given source folder in the project to a selected folder on the filesystem.

Finally here is my setup. Install the FileSync plugin first!!! Do everything i mean adding a new server runtime. Do not add the project now. Open the server runtime settings first and change a couple of settings. Set the option to "Never publish automatically." Next select the option to "Use custom location" and browse to a folder. The server will create the wtpwebapps folder underneath this folder. Next under server options select the options "Serve modules with out publishing". Once that's done, go to project properties and set the File Synchronization plugin properties setting the target folder as the new wtpwebapps\ folder and save.
From then on just a "Force File Sync" on the project before starting the project is doing for me.

If the WTP simply does a differential copy/sync i would not do all this stuff. Need to explore further if there is a way to fire the force file sync whenever we start the server :)

No comments:

Post a Comment