Building Projects with Eclipse from the Command Line

Eclipse has a great user interface (UI). But what if I want to do things from the command line, without the GUI? For example to build one or more projects in the workspace without using the Eclipse UI? With this, I can do automated check-outs and do automated builds.

Performed a command line project build with Eclipse

Performed a command line project build with Eclipse

The solution to this: there is a command line version of Eclipse which I can use to run Eclipse in the command line version. Inside the eclipse folder on Windows, there is the eclipsec program which is the command-line version of Eclipse:

Eclipsec program, a command line version of Eclipse

Eclipsec program, a command line version of Eclipse

The options of this command line version (for Eclipse Kepler) are described here:

http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html

For example

eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data c:\my_wsp -build k64f

will launch Eclipse without splash screen (-nosplash), uses the –application command to load the managed make builder (which is used to build projects), with -data I specify the workspace to be used, and with the -build command it will the project k64f.

Now it could be that things still fail. This is typically because –launcher.ini option is missing which should point to the eclipse .ini file which located in the same folder as eclipsec. For example for Kinetis Design Studio the call could look like this:

c:\freescale\kds_3.0.0\eclipse\eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data .\wsp_kds3.0.0 -build MyProject --launcher.ini c:\Freescale\KDS_3.0.0\eclipse\kinetis-design-studio.ini --launcher.suppressErrors

More options and details are shown here: http://stackoverflow.com/questions/344797/build-several-cdt-c-projects-from-commandline

And a very good article with additional background information how to use it with the GNU ARM Eclipse plubins can be found here: http://gnuarmeclipse.livius.net/blog/headless-builds/

Happy Headlessing 🙂

Advertisements

15 thoughts on “Building Projects with Eclipse from the Command Line

      • I run “eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data D:\phuc\hello_world -build hello_world” but this print in cmd : “No Project matched “hello_world”. Skipping…”. I sure project hello_world exist in D:\phuc\hello_world

        Like

      • Thanks. I change this and I get error : “Managed Build system manifest file error: Option ilg.gnuarmeclipse.managedbuild.cross.option.warnings.unitialized.6460917372 uses a null category that
        is invalid in its context. The option was ignored.” I think -application org.eclipse.cdt.managedbuilder.core.headlessbuild need be changed!

        Like

  1. Hi Erich

    I follow the step by step to build the project from eclipse command line.
    But get an error: Program “make” not found in PATH.
    My KDS version is 3.1.0.

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s