Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Executing Multiple Commands as Post-Build Steps in Eclipse

DZone's Guide to

Executing Multiple Commands as Post-Build Steps in Eclipse

· Java Zone ·
Free Resource

The CMS developers love. Open Source, API-first and Enterprise-grade. Try BloomReach CMS for free.

The GNU ARM Eclipse plugins from Liviu already offer several built-in actions which can be performed at the end of a build: creating flash image, create listing file and printing the code and data size:

GNU ARM Eclipse Extra Post Build Steps

GNU ARM Eclipse Extra Post Build Steps

But what if I need different things, or even more things?

Post-Build Steps

For this there is the ‘Post-build steps’ settings I can use: that command is executed at the end of the build:

Print Size PostBuild Step

Print Size Post-Build Step

:!: The post build step is only executed if sources files have been compiled and linked. If you want to enforce that there is always a ‘true’ post build, then you need to delete some files in the Pre-build step to enforce a compilation and a link phase.

Multiple Post-Build Steps

But what I need more than one action in the post-build step? I could call a batch or script file, but this is probably an overkill in too many cases, and adds a dependency to that script file. A better approach is to directly execute multiple commands as post-build step.

Unfortunately, the documentation found about the post-build step with a web-search is misleading (e.g. in the Eclipse Luna documentation):

“Command: Specifies one or more commands to execute immediately after the execution of the build. Use semicolons to separate multiple commands.”

Unfortunately, semicolons is plain wrong (at least did not work for me) :-(. The solution is to use ‘&‘ (ampersand) to separate multiple commands on Windows:

:idea: On Linux, use the ‘;’ to separate commands as noted in the documentation/help, and use ‘&’ on Windows. Unfortunately, this makes project not cross-platform.

Multiple Post-Build Commands

Multiple Post-Build Commands

And this works for me, at least under Windows 7 :-).

BloomReach CMS: the API-first CMS of the future. Open-source & enterprise-grade. - As a Java developer, you will feel at home using Maven builds and your favorite IDE (e.g. Eclipse or IntelliJ) and continuous integration server (e.g. Jenkins). Manage your Java objects using Spring Framework, write your templates in JSP or Freemarker. Try for free.

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}