Over a million developers have joined DZone.

Executing Multiple Commands as Post-Build Steps in Eclipse

· Java Zone

Thrive in the application economy with an APM model that is strategic. Be E.P.I.C. with CA APM.  Brought to you in partnership with CA Technologies.

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

Navigate the Maze of the End-User Experience and pick up this APM Essential guide, brought to you in partnership with CA Technologies

Topics:

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

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}