Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I clone a whole project in IntelliJ Idea?

I want to run some tests in my project but I do not want to affect the original code, and I wanto to clone the project so I can run tests there

Does anyone know how to clone a project on IntelliJ Idea 11?

like image 209
ocespedes Avatar asked Jun 11 '13 00:06

ocespedes


4 Answers

Using your operating system File Explorer tool, just copy and paste the entire project directory somewhere new. All of the configuration should use relative paths by default.

If your IDEA project is .ipr based, then delete the new .iws file before opening the project. If your IDEA project is .idea directory based, then delete the workspace.xml file before opening the project.

like image 126
Jen S. Avatar answered Nov 06 '22 00:11

Jen S.


If you want to copy and rename the project too, like I wanted to clone a project in order to use it with a newer version of IntelliJ.

  1. Copy the whole directory to a new location, for example on Linux:

    cp -r myproject new/location/

  2. To rename the project:

    2.1. rename the project folder (e.g. mv myproject newproject)

    2.2. get into the new project folder (e.g. cd newproject) and edit the .name file with a text editor.

Open the new project now in IntelliJ (you may want to remove the workspace.xml if you don't want to keep the open file history - I kept it) and enjoy your new project!

like image 30
ksymeon Avatar answered Nov 06 '22 02:11

ksymeon


For copy with rename I had to do one more step to get it to stop referencing the old module name. That was to right click on the module in the project pane and do Refactor > Rename ( or do Shift + F6 ) to rename the module.

This was for IntelliJ IDEA 2016.3.3

like image 2
yokeho Avatar answered Nov 06 '22 00:11

yokeho


I had a gradle project and the provided answers did not work. The project did not have a structure in IntelliJ and I did not see the source files.

The following worked:

  1. Export project (Export to zip file)
  2. Move the zip file somewhere new
  3. Unzip
  4. With IntelliJ, import as a new project with "open".

Better Solution of course:

Have it in a git directory, make a "test-branch" and try whatever you want to try.

like image 2
henriette_r Avatar answered Nov 06 '22 00:11

henriette_r