jQuery in Action, 2nd edition*
The moose likes IDEs, Version Control and other tools and the fly likes copy paste existing eclipse project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "copy paste existing eclipse project" Watch "copy paste existing eclipse project" New topic
Author

copy paste existing eclipse project

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 269
I have one perfectly working shopping cart sample servlet web project(say name sampleweb) with 10 different servlets, 12 different html pages. I want to copy paste same project into new project
(say sampleweb_enhance)and enhance the application little bit more by adding couple of more servlets, couple of more HTMLs without disturbing orignal project. I am able to copy but I am not able to paste when I go to File option under Eclipse top menu.

Alternately I went to my physical C:\eclipse_workspace folder and copied sampleweb folder and pasted it and renamed it as sampleweb_enhance.

Now I went to eclipse and went to File then new dynamic web project and gave project name as sampleweb_enhance. I gave project location as C:\eclipse_workspace\sampleweb_enhance.

When sampleweb_enhance opened in eclipse 'src' directory under 'Java Resources' is empty and also 'WebContent' directory is also empty

what is the best way to achieve it. I do not want to do manual copying each and every file, libraries, htmls pages and set up bilid path etc

Please advise. Thanks in advance
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Use Git and save yourself from copy/paste or other alternatives. Just create a new branch each time you want to keep stable version of your project safe, but also want to experiment with it or try to enhance it.

By the way, paste is never in the File menu.


The quieter you are, the more you are able to hear.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Here is what I do. Let's say your project's name is shopping. Using a file manager I copy the shopping directory as shopping2 (in the same workspace). Then I edit the shopping2/.project file with a text editor changing the project name to shopping2. Then in Eclipse I do File | Import | General | Import existing project into Eclipse. In the import dialog I open the workspace directory, then all of the projects are listed (most of then are greyed out because they are already in Eclipse) and I select the shopping2 project. That's it. Now I have a shopping2 project that looks exactly like shopping. By the way, I do this all the time, works great.

Oh, if your project is under source control, after copying shopping to shopping2, make sure you remove the source control data files - you don;t want to mess up the original project. For example, I always delete the .svn directories under shopping.


JBoss In Action
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3610
    
  60

Peter Johnson wrote:Oh, if your project is under source control, after copying shopping to shopping2, make sure you remove the source control data files - you don;t want to mess up the original project. For example, I always delete the .svn directories under shopping.

That depends on the source control software. In distributed systems, the copy can live independent life from the original, but still retaining all history. And in case the projects should be merged again, it is generally possible (though if they diverge a lot, it can be too hard to do).

In my opinion, distributed source control systems are ideal for small/hobby projects.
sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 269
File | Import | General | Import existing project into Eclipse. In the import dialog

Here I see two radio button options
1. select root directory
2. select archive file

which one shall i choose. Please advise
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

If you followed the guidelines given by Peter Johnson then the first option is the right one. Then click on Browse button and choose the directory where your project is copied to (e.g. shopping2).
sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 269
my project's name is ServletExample. Using a file manager I copy the shopping directory as ServletExample2 (in the same workspace). Then I edit the ServletExample2/.project file with a text editor changing the project name to shopping2. Then in Eclipse I did File | Import | General | Import existing project into Eclipse. In the import dialog I opened the workspace directory by selecting
select archive file option

as in the attachment.

It is asking for some file name which I am not sure. Please advise




[Thumbnail for importProject2.JPG]

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 269
select root directory radio button option worked fine as in the attachment.

I wonder what are the differences between those two radio button options

Please advise



[Thumbnail for importProject3.JPG]

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 269
If I have to run the same SErvletExample on NetBeans IDE how do I do it. Please advise
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Importing and Exporting Java Projects in Eclipse
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Please PostTextNotScreenshots.

If you want to import an Eclipse project into NetBeans, go to File -> Import project -> Eclipse project...
  • To import an entire Eclipse workspace choose the first option (Import Projects from Workspace), then click Browse and navigate to your workspace folder.
  • To import only one Eclipse project choose the second option (Import Project ignoring Project Dependencies) and then specify location of project to import and destination folder.
  • sai rama krishna
    Ranch Hand

    Joined: May 29, 2009
    Posts: 269
    sure. I will avoid screenshot as much as possible.

    I imported the single eclipse project successfully into netbeans and working fine there as well.

    I see one issue. The URL it is launching the login page initially is

    http://localhost:8080/WEB-INF/


    which is continuiong later also.

    I expected some thing like

    http://localhost:8080/ServletExample2

    please advise
    sai rama krishna
    Ranch Hand

    Joined: May 29, 2009
    Posts: 269
    How do I change context name. Please advise
    sai rama krishna
    Ranch Hand

    Joined: May 29, 2009
    Posts: 269
    I did to imported an Eclipse project into NetBeans by going to File -> Import project -> Eclipse project.

    How to do otherway around. I mean how to import netbeans project into eclipse. Please advise
    Maneesh Godbole
    Saloon Keeper

    Joined: Jul 26, 2007
    Posts: 10451
        
        8

    Please ShowSomeEffort and SearchFirst on which you would have found http://www.coderanch.com/t/458555/vc/Export-Netbeans-Eclipse


    [How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
    sai rama krishna
    Ranch Hand

    Joined: May 29, 2009
    Posts: 269
    sure
    sai rama krishna
    Ranch Hand

    Joined: May 29, 2009
    Posts: 269
    that other post is still has one valid open question as in the last comment

    Is there a typo? In Step III you said to copy from "c:\Users\Almir\Eclipse\ToEclipse\bin" and to paste it to "c:\Users\Almir\Eclipse\ToEclipse\bin". Same directory isn't it?

    Shishir Shivhare
    Greenhorn

    Joined: Nov 09, 2012
    Posts: 7
    How to do otherway around. I mean how to import netbeans project into eclipse. Please advise


    If there is no option in eclipse for importing netbeans project then you have to create new project in eclipse and copy all files in it because .metdata of eclipse and netbeans are used to be different.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: copy paste existing eclipse project