Reputation: 2999
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!
Upvotes: 11
Views: 9712
Reputation: 6030
A few things to note:
-import
option multiple times/
instead of \
).foo
in the directory path/to/FooBar
, the option would be -import path/to/FooBar
Here is a real world example that I use.
eclipsec -noSplash -data "WORKSPACE2" -application org.eclipse.cdt.managedbuilder.core.headlessbuild -no-indexer -import 21-6912-xx-xpathparser -import 21-6912-xx-xpathparser/lib
output:
Create.
Opening 'libxpathparser'.
Create.
Opening '21-6912-xx-xpathparser'.
Saving workspace.
Upvotes: 1
Reputation: 11841
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}
Upvotes: 2
Reputation: 999
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
.
Upvotes: 9
Reputation: 8849
You can find list of eclipse runtime options here: Help > Workbench User Guide > Tasks. Format : eclipse [platform options] [-vmargs [Java VM arguments]]
Upvotes: -3