One build, multiple targets


I am building a script that has to build EJB jars for multiple application servers and version. Bottom line, some processing needs to happen after the jar is built. This processing is application server and version specific (the same jar is processed once with WAS 6.1 and generates me a new jar, and once with WAS 7, it generates yet another jar). After I need to pick up those jars and use them in a ear task (depending if I build a WAS 6.1 or 7 ear I have to pickup the correct jar).

Of course I would like to reuse the same original jar to avoid having to recompile it.

What is the best way to achieve this?




Anyone has any suggestion?


The best way depends on a lot of factors. It’s hard to give concrete advice because there are so many variables.

I’d start with a multiproject build, with a project for the common stuff and then a project for each variant. The variants would include the common stuff. To do this, you’ll have to do some research on ‘Copy’ tasks.

If you make a start and ask more specific questions we’ll be able to give you better help.