Avoid error exit status when running eclipse in headless build mode
Edit: This issue came from a misinterpretation of the error output. In fact, the configuration build failed, which I was not interested in. So I excluded the config from the build command (see answer).
I am running a build script that, in one instance, starts a mute build with eclipse, for example:
set -e # ... eclipse -nosplash \ -application org.eclipse.cdt.managedbuilder.core.headlessbuild \ -import ./ \ -I /usr/lib/jvm/java-7-openjdk-i386/include/ \ -I /usr/lib/jvm/java-7-openjdk-i386/include/linux \ -cleanBuild all
The assembly has successfully implemented the built-in libraries. However, it seems that after the build finishes, eclipse will try to start the gui. And since I run the script in an environment that does not have a window manager, it fails and eclipse returns an error code and hence causes my script to crash. I would really like to see it really fail if there is a real problem. Therefore, I would not like to delete the command
. How can I get eclipse not to try to launch its gui? Or is there some sane workaround for this?
Here is the eclipse output after the libs build finished:
Invoking scanner config builder on project Eclipse: Cannot open display: Eclipse: Java was started but returned exit code=1 -Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256m -Xms40m -Xmx512m -Djava.class.path=/vagrant/exec/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar -os linux -ws gtk -arch x86 -launcher /vagrant/exec/eclipse/eclipse -name Eclipse --launcher.library /vagrant/exec/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.200.v20140603-1326/eclipse_1605.so -startup /vagrant/exec/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.appendVmargs -product org.eclipse.epp.package.cpp.product -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import ./ -I /usr/lib/jvm/java-7-openjdk-i386/include/ -I /usr/lib/jvm/java-7-openjdk-i386/include/linux -cleanBuild all -vm /usr/lib/jvm/java-7-openjdk-i386/jre/bin/../lib/i386/client/libjvm.so -vmargs -Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256m -Xms40m -Xmx512m
source to share
This was the case where I was reading the output wrong. My problem was that I used the option
, while the system has only one configuration, which can be created in the system, which can cause an attempt to open a dialog with an error. The name of the configurations was
accepts regex input, so I ended up doing the build like this:
eclipse -nosplash \ --launcher.suppressErrors \ -application org.eclipse.cdt.managedbuilder.core.headlessbuild \ -import ./ \ -I /usr/lib/jvm/java-7-openjdk-i386/include/ \ -I /usr/lib/jvm/java-7-openjdk-i386/include/linux \ -cleanBuild .*/.*posix.*
source to share