Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import multiple projects into Eclipse using command line?

Is there anyway that I can use command line to import multiple projects into Eclipse workspace all at once? I noticed that someone suggests using command line as follows:

eclipse -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -importAll {[uri:/]/path/to/project}

But I cannot figure out the {[uri:/]/path/to/project} part correctly. Any example? Also, is the above command line the only way I can achieve this? (it seems like to depend on CDT?) Is there any other way I can do this in command line?

Thank you!

like image 812
Ida Avatar asked Apr 28 '12 03:04

Ida


2 Answers

The only documentation of headlessbuild I've found so far is the source. This reveals that the argument to -importAll should be the path to a directory containing all your projects. You can use -importAll repeatedly to import multiple trees of projects.

e.g. if you have the structure

tree/
  core/
    alpha/
      .project
    beta/
      .project
  edge/
    one/
      .project
    two/
      .project

Then this will build the four projects in a workspace tree/workspace:

cd tree
eclipse -nosplash -data workspace -application org.eclipse.cdt.managedbuilder.core.headlessbuild -importAll core -importAll edge -build

On Windows, use eclipsec.exe.

like image 154
James Avatar answered Nov 16 '22 00:11

James


The Eclipse CDT provides tools to import projects via the command line. You can use the following command / options to do so.

eclipse -nosplash 
  -application org.eclipse.cdt.managedbuilder.core.headlessbuild 
  -import     {[uri:/]/path/to/project} 
  -importAll  {[uri:/]/path/to/projectTreeURI} Import all projects under URI
  -build      {project_name | all} 
  -cleanBuild {project_name | all} 
like image 20
cmd Avatar answered Nov 15 '22 23:11

cmd