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

Try Okta to add social login, MFA, and OpenID Connect support to your Java app in minutes. Create a free developer account today and never build auth again.

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 :-).

Build and launch faster with Okta’s user management API. Register today for the free forever developer edition!

Topics:

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}