Hi guys... How can I automate the process of building a new jar file for a project in eclipse ? Is there a way to do this without perturbing the entire build process ? I would rather not use ANT because eclipse appears to be so smart, that I dont want to replace whatever logic eclipse uses under the hood with my own, somewhat buggy (possibly) logic for rebuilding a jar.
Essentially, I have 5 projects, and I want changes to the source in those projects to automatically result in construction of new Jar files, so that the main project, which depends on those 5, can be exported as an executable jar file which is 100% concurrent with the sub projects.
Eclipse does not use Ant under the hood (as far as I know). (NetBeans uses Ant, however.) But you can change your project to be built with Ant. Go to Project > Properties, than under Builders, click New, choose Ant Builder and fill in the information. Then you can use the Ant build from Eclipse or from the command line or a script.
Beware, however, that Eclipse tries to be "helpful" when running the Ant build, and that can cause problems. You need to be careful that your Ant script always runs properly from the command line.
What do you mean by eclipse tries to be :helpful: ? Ive been using to manage my complex java projects via eclipse for so long I'm not quite sure where to start moving into this brave new world of custom builds. Where should I start ?
If I recall correctly, Eclipse adds several system properties to the Ant command, which can cause the build to work correctly while being used within Eclipse, but incorrectly when used from a command line.
The best place to start learning Ant is with a good book - I recommend Ant in Action - I have the previous version of that book and find it indispensable.
You can actually tell Eclipse to create build files to be able to run as stand-alone or as Eclipse build files. If you tell Eclipse not to use the Eclipse builder but the Ant builder as default, it creates build.xml files that can be run under Eclipse.
However, if you export the project as external build, then it creates ant-task that is totally independent of Eclipse.
Also, it is really easy to call the Eclipse builder from Hudson of Cruise.