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.
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:
The options of this command line version (for Eclipse Kepler) are described here:
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
Happy Headlessing 🙂
As the -application option suggests, this technique is also called ‘headless build’.
It was tested and confirmed working with GNU ARM Eclipse Plug-ins too.
gnuarmeclipse.livius.net/blog/headless-builds/
LikeLike
Hi Liviu,
thanks for that link (added to the article now), I had missed this one.
LikeLike
Can I building Projects with KDS from the Command Line? KDS base on Eclipse
LikeLike
Yes, the exact same thing works in Kinetis Design Studio too.
LikeLike
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
LikeLike
With the -data you need to specify the *workspace*, not the project.
LikeLike
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!
LikeLike
I don’t have that. I have other errors, but I can ignore them, as it builds fine.
Maybe this is something you should report to the GNU ARM Eclipse plugins?
LikeLiked by 1 person
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.
LikeLike
You need to add the make to your PATH. The make is located here:
“installation path of KDS”\bin
LikeLike
Hi Erich
I copy the make file to my path “KDS_3.0.0\eclipse”.and get another error information as below.
Did I need to install other SDK package?
LikeLike
Copy the make file does not help. You need to make sure that the make executable is in your PATH.
Erich
LikeLike
Hi Erich
Sorry for bother you.
And…how to make sure that the make executable in my PATH?
Thanks.
LikeLike
Hi Erich
I fixed the PATH issue after add these two path for “make.exe” and “arm-none-eabi-gcc.exe”.
C:\Freescale\KDS_3.0.0\bin
C:\Freescale\KDS_3.0.0\toolchain\bin
Thanks for your help.
LikeLike
Hi Erich
I fixed the PATH issue.
But got build error message as below.
LikeLike
Hi Eric,
I am using KDS 3.2.0 . I would like to be able to build my projects from command line. I am running the following command:
C:\Freescale\KDS_v3\eclipse\eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data C:\Work\KDS_Workspace -build –launcher.ini c:\Freescale\KDS_v3\eclipse\kinetis-design-studio.ini –launcher.suppressErrors
I get the following message:
Project: doesn’t appear to be a CDT project. Skipping…
Any clues?
Many thanks!
LikeLike
Hi Radu,
I see you not specified a project with the -build argument? You need to specify the project you want to build, e.g.
-build MyProject
I hope this helps,
Erich
LikeLike
Hi Erich,
Sorry, I misspelled the command. I am using a project name as argument for build. However for any project I am trying, I get the same error. I’m thinking that’s something I’m not doing right.
What I would like to actually achieve is to build from command line the MCUXpresso projects. This is the reason why I have started with KDS, as I thought it would be similar to transition from one to the other.
LikeLike
Hmm, I have not tried this with the MCUXpresso IDE, but I would assume it would be the same too?
LikeLike
MCUXpresso is basically the next-gen LPCXpresso, so the following should apply: https://community.nxp.com/thread/388962
LikeLiked by 1 person
Hi Eric,
I have managed to find the solution to my error. I had to add the project to the workspace.
KDS:
C:\Freescale\KDS_v3\eclipse\eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
-data C:\Work\KDS_Workspace
-import C:\Work\KDS_Workspace\
-build
–launcher.ini c:\Freescale\KDS_v3\eclipse\kinetis-design-studio.ini –launcher.suppressErrors
MCUXpresso:
mcuxpressoidec -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
-data
-import
-cleanBuild
LikeLiked by 1 person
Hi Radu,
thanks for sharing! Could it be that commands you have posted are not complete?
If your project was not part of the workspace, yes, indeed you have to have it present in the workspace.
LikeLike
Hi Eric,
I was using “” characters to specify project paths or project names. I believe that when I hit Post button, whatever was written between those characters did not get posted.
Reposting the commands that worked for me:
KDS:
C:\Freescale\KDS_v3\eclipse\eclipsec.exe -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
-data C:\Work\KDS_Workspace
-import C:\Work\KDS_Workspace\”project folder”
-build “project name ”
–launcher.ini c:\Freescale\KDS_v3\eclipse\kinetis-design-studio.ini –launcher.suppressErrors
MCUXpresso:
mcuxpressoidec -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild
-data “path to the workspace”
-import “path to the project ”
-cleanBuild “project name”
Also the commands are split on multiple lines for readability. One would need to concatenate the command in one line.
LikeLike
Many thanks for posting you solution, appreciated!
LikeLike
Pingback: Building Eclipse and MCUXpresso IDE Projects from the Command Line | MCU on Eclipse
Hi Erich. I’m using MCUxpresso 11.6 and I would like to clean and build all build configurations from command line.
Unfortunately the resul of my command is it only builds the active build configuration despite I’m using project name only instead of projectname/buildcfg.
Of course on the IDE side I can build all of them.
Here is my command:
C:\nxp\MCUXpressoIDE_11.6.0_8187\ide\mcuxpressoidec.exe -nosplash –launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild -data C:\Users\rpao\Documents\MCUXpressoIDE_11.6.0_8187\workspace -cleanBuild CDSR_KV42
Where am I wrong?
Thank you very much
Best Regards
Roberto
LikeLike
Hi Roberto,
have you seen https://www.nxp.com/docs/en/user-guide/MCUXPRESSO-IDE-COMMAND-LINE-UG.pdf :
4. For each project, multiple build configurations can be compiled and build. To control tested
configurations, you can use build.config property from the generated properties file
LikeLike