Search code examples
javaeclipsemaven-3m2eclipse

Export Maven3 project from one eclipse instance to another


I have created a Maven3 web project in eclipse STS (maven-archetype-webapp).

Now I'd like to carry around that project between two machines by just exporting it from eclipse and importing it into eclipse on the other machine.
My aim is to have a perfect clone of the project under development with all its sources in my eclipse IDE on the other machine, so that I can just go on working.

With ordinary Java EE web apps I've always imported and exported a war-file. With the maven project I'm losing the pom-file and my dependancies doing it like that.
Using "maven package" from the command-line I still loose the pom and get the depenencies carried along in the war as jars. I'd prefer to have it the other way round, keeping the pom-file and having new dependencies downloaded into the local repository on the target-machine.
On the other hand just copying the project's workspace-directory to the target machine I got maven dependency issues.

Of course I might be able to tweak the desired behaviour out by elaborate configurations of packaging parameters in the pom-file, but there must be a more straight-forward way than that ...

So what is the simplest way to just clone a maven3 project in eclipse to another instance of eclipse, ideally from within the IDE?


Solution

  • The easiest solution is, as BigMike said, to just copy the project folder to a USB flash drive, copy it onto target computer and import it into local Eclipse workspace via Import Existing Projects into Workspace. But copying large number of small files to a USB flash drive (or anywhere else) takes more time then copying one large ZIP file.

    And Eclipse already has that functionality :-)

    To package the project right click on it (project root) and Export... > General > Archive File > Next > specify the file name and click Finish.

    On the receiving side do File > Import... > General > Archive File > Next > select the file and click Finish.