Copying a Project


How can I make a copy of an entire project in IntelliJ IDEA? I need to copy a project and rename it. 

Also, how can I copy files from one project to another?

Many thanks in advance,



You can do it only outside of IDEA using your favorite file manager. Rename can be performed in IDEA after you open the copied project in it.


Serge, many thanks. After I copy the project do I need to do anything special to open it in IntelliJ?



No, just File | Open and point to the new location.


When I did this and I had both projects open at the same time, I started getting complete nonsense errors, like

class Test {
static void a() {
Test.b(); // cannot access class Test

or when I deleted a class from project 1, it started showing errors in project 2 as if the class didn't exist there either. It looks like copying a project folder makes both projects use the same caches and ends up completely corrupting them. Invalidating caches just led to more weird errors. What worked was going into workspace.xml and manually changing the project id.

Can IDEA handle this better?


Chylek Try to remove/rename workspace.xml file in the ".idea" folder under the project's root. This should help. 


I already edited it, I'd like to ask if IDEA could work better in this case. Maybe detect that the project folder has changed and use different caches, or detect that two projects are modifying the same caches at the exact same time and ask what to do, rather than silently breaking the caches and ending up with cryptic errors in the editor.


I've never had 100% luck with any solution other than

  1. Creating a new directory, "NewProject" (In my case, I always name the project itself the same as the directory later).
  2. Copying all the .java and .txt and any other files you created manually from OldProject to the new Project.  Do not copy over any .iml project file or .idea/ directory.  This should simply be a directory of your .java tree, and little else.
  3. build a new project from within the IDE, and using NewProject as the name for everything.

OR (and this doesn't work every time, and I don't know why):

  1. Copy the ENTIRE project directory to the new Directory.  I always keep project names and directory names precisely the same.
  2. grep -r <OldProjectName> in that new project directory.
  3. modify each and every text instance of it.  Keep track if you see the actual path names change too.
  4. All your settings should be changed for the project.  Again though, this doesn't *always* work.



Please sign in to leave a comment.