Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy an eclipse dynamic web project?

Tags:

eclipse

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

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

It looks like eclipse is not updating all the old name references when it makes the copy.

How do I make a good clean copy of an existing project?

like image 226
John Avatar asked Aug 13 '10 19:08

John


1 Answers

After some more searching I found this in the eclipse bug site.

Steps To Reproduce:

  1. create a Dynamic Web Project and call it "Project1"
  2. copy and paste this project, in order to create another one which is a clone of the first; in the "Paste" dialog, specifiy "Project2" as the name of the target project (instead of "Copy of Project1")

OBSERVED BEHAVIOUR:

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

This causes problems when deploying modules to the server. Moreover, the module name can't be easily changed through the GUI from anywhere.

EXPECTED BEHAVIOUR:

The copy&paste operation should update the web module name to "Project2", just like it happens when you rename a project.

WORKAROUND:

Make sure 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 deploy-name attribute value of the wb-module element. Close and restart Eclipse (!!!) and the new name will be taken. If you don't restart Eclipse, even if you edit org.eclipse.wst.common.component from within Eclipse, WTP does not take the change (it seems it's caching it somewhere in memory...).

like image 50
John Avatar answered Nov 12 '22 00:11

John