Reputation: 3843
In Eclipse, I have one existing project, A. Right now, I have just created another project, B, which is empty. Is it possible to copy all the files of project A, including its source code and related libraries to project B? There are a lot of involved libraries in project A. How to do this copying process correctly to ensure the copied files can still be compiled?
Upvotes: 34
Views: 95331
Reputation: 1
For a Gradle project, I had to add two extra steps to mOna's answer, which I will copy for completeness.
I assume that the renaming in some of the above answers does step 6, but I couldn't get it to work. No matter what I tried, without those extra steps the code looked ok but dependencies were not handled correctly and errors appeared everywhere. I was even able to run gradle on my project from the command line and it "built", but was actually building the old project.
Upvotes: 0
Reputation: 31
In the project Explorer, right click your old project, click "Copy", right click again click on "Paste" this time, change the default given name "Copy of My_Old_Project" to any of your choice, after the copy is done, go to the "Search" tab in Eclipse, then to --> "Search", on the File Search, type the old name of your project, make sure that your scope is only "Enclosing project", change all occurrences into the new name, run the project, you are all set...
only thing I noticed about this is that the url will still be of the old project.
Upvotes: 1
Reputation: 2459
Upvotes: 5
Reputation: 6147
This question appears in Google search as top result for query "copy project in eclipse".
To copy project in Eclipse:
1) right click on project in Package Explorer view;
2) choose Copy;
3) right click on free place in Package Explorer view;
4) choose Paste;
5) enter new name in the prompt window.
To answer actual question, the best way is to delete project B and after -- copy project A as explained above and give it name B.
Upvotes: 52
Reputation: 514
Enjoy them!
Upvotes: 17
Reputation: 6937
Since B is empty, you can just copy project A in the Package Explorer and name the copy B.
Upvotes: 6
Reputation: 597
Eclipse has a option in file menu like import existing projec.From that you can import the existing project with all content.I hope this is the solution that you are looking for.
Upvotes: -1
Reputation: 18777
You can Import the project
OR
Assuming both project A and B are of same type:
You can copy the contents of src
folder as it is.
For the libraries, just go to the build path and add them in the ssame way you did for project A.
Upvotes: 6