eclipseworkspace

Why when I rename a project in Eclipse does Tomcat not pick up the new resource name?


I did refactor > rename on a project in my workspace, but then when I went under the servers tab and did a right-click > Add and Remove for my Tomcat server in order to modify the resources configured on the server, the resource name for my project is my old project name. I looked everywhere to try and change this, like some sort of Tomcat config file or setting, but I can't find it anywhere. So my project is named one thing, but is configured as a resource on the server under a different name. How do I change this?


Solution

  • I believe you are looking for a hidden pref located under your project/.settings/org.eclipse.wst.common.component.

    The beginning of the file should look roughly like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <project-modules id="moduleCoreId" project-version="1.5.0">
        <wb-module deploy-name="projectB">
    

    So just change the deploy-name. Another thing that I recommend changing is the project's context root, right-click the project -> Properties -> Web Project Settings.

    (just to clarify, to the best of my understanding this behavior is a bug in WTP. WTP is responsible for maintaining the hidden pref file under .settings, and it just doesn't update the file when the project is renamed)