How to copy a dynamic eclipse web project?

I have a workspace with a dynamic web project. When I try to copy and paste a project into the same workspace, eclipse asks for the name of the new project, then copies the files.

The problem is that when you deploy this project to the server, it is deployed with the original name and not with the new name.

It seems that eclipse does not update all old name references when creating a copy.

How to make a good clean copy of an existing project?

+7
eclipse
source share
1 answer

After some searching, I found this on the eclipse error site.

Steps to play:

  • create a dynamic web project and name it "Project1"
  • copy and paste this project to create another one that is a clone of the first; in the "Insert" dialog box, specify "Project2" as the name of the target project (instead of "Copy project1")

OBSERVING BEHAVIOR:

The context root of the target project is the same as the original project. This may be a problem, but it can be easily updated in the project settings and / or in the server editor (module tab). However, even the name of the module is the same, although it is usually equal to the name of the project. So, in Project2 / .settings / org.eclipse.wst.common.component I find the following:

This causes problems when deploying modules to the server. In addition, the module name cannot be easily changed via the graphical interface from anywhere.

EXPECTED BEHAVIOR:

The copy and paste operation should update the name of the web module to "Project2", only for example, when renaming a project.

Temporary solution:

Make sure that the module corresponding to the target project has not been added to the server. Then manually edit Project2 / .settings / org.eclipse.wst.common.component and change the deployment name to the attribute value of the wb-module element. Close and restart Eclipse (!!!) and the new name will be accepted. If you don't restart Eclipse, even if you edit org.eclipse.wst.common.component from Eclipse, WTP will not accept (it seems to cache it somewhere in memory ...).

+9
source share

All Articles