Thursday, May 5, 2011

Changing the context root of a Dynamic Web Project in Eclipse

I always hated that when I created a Dynamic Web Project in Eclipse (I used 3.4 and 3.6), the context root of the deployed application was always the same as my project name. So I can't have a descriptive project name like 'The Company - concept test 1'. I'd have to have names like 'boc' as my Eclipse project name.

So now (yes, call me slow), I found out how I can dynamically change the context root that Eclipse will deploy my project application with.

When I create a Dynamic Web Project, a .settings folder would be automatically created for me. In that folder, in an XML file called: org.eclipse.wst.common.component, there will be elements called 'property'. One of those elements has a name-value attribute pair called 'context-root'. Change the value of that attribute, and republish your project.


1 comment:

  1. hey..yes nice explanation. Thanks. I have given here with image representation for your easy understand ..Go through this.